The first part of this analysis looks at the temporal intersubject correlation - how well the subjects data align over time. Looking at this will allow us to get a measure of “typciality” - how typical an individual subject’s brain data is.

One big caveat here (for both these analyses) is that they’re currently done using the SMOOTHED data.

library(tidyverse)
## ── Attaching packages ──────────────────────────────────────────────────────────────────────────────────────── tidyverse 1.3.0 ──
## ✓ ggplot2 3.3.2     ✓ purrr   0.3.4
## ✓ tibble  3.0.3     ✓ dplyr   1.0.1
## ✓ tidyr   1.1.1     ✓ stringr 1.4.0
## ✓ readr   1.3.1     ✓ forcats 0.5.0
## ── Conflicts ─────────────────────────────────────────────────────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
library(psych)
## 
## Attaching package: 'psych'
## The following objects are masked from 'package:ggplot2':
## 
##     %+%, alpha
library(patchwork)
library(reshape2)
## 
## Attaching package: 'reshape2'
## The following object is masked from 'package:tidyr':
## 
##     smiths
library(reticulate)
library(rmatio)
library(rstatix)
## 
## Attaching package: 'rstatix'
## The following object is masked from 'package:stats':
## 
##     filter
reticulate::use_python("/Users/catherinewalsh/miniconda3/bin/python")

load('data/behav.RData')
load('data/split_groups_info.RData')
load('data/ISC_data.RData')

se <- function(x) {
  sd(x,na.rm=TRUE)/sqrt(length(x[!is.na(x)])) 
}

source("helper_fxns/avg_ISC.R")
source("helper_fxns/corr_ISC.R")

rects <- data.frame(xstart=c(7),xend=c(9))

Temporal ISC

Want to look at which regions show a load effect because we’re looking at a lot of the Yeo ROIs.

load_effect_LOO <- fisherz(high_correct_ISC_LOO) - fisherz(low_correct_ISC_LOO)

load_effect_LOO[load_effect_LOO == -Inf] <- NA
load_effect_LOO[load_effect_LOO == Inf] <- NA

LOO_results <- data.frame(t=matrix(nrow=297),p=matrix(nrow=297), sig_05=matrix(nrow=297), sig_corrected=matrix(nrow=297))
# one sample t test against 0 

for (region in seq.int(1,297)){
  temp <- t.test(load_effect_LOO[,region])
  LOO_results$t[region] <- temp$statistic
  LOO_results$p[region] <- temp$p.value
  if (temp$p.value < 0.05){
    LOO_results$sig_05[region] <- TRUE
  } else {
    LOO_results$sig_05[region] <- FALSE
  }
  if (temp$p.value < 0.05/297){
    LOO_results$sig_corrected[region] <- TRUE
  } else {
    LOO_results$sig_corrected[region] <- FALSE
  }
}

print("Regions that show a load effect (corrected for multiple comparisons): ")
## [1] "Regions that show a load effect (corrected for multiple comparisons): "
labels[LOO_results$sig_corrected,]
##  [1] "7Networks_LH_Vis_5"                "7Networks_LH_Vis_11"              
##  [3] "7Networks_LH_Vis_18"               "7Networks_LH_Vis_21"              
##  [5] "7Networks_LH_Vis_22"               "7Networks_LH_Vis_23"              
##  [7] "7Networks_LH_Vis_27"               "7Networks_LH_DorsAttn_Post_5"     
##  [9] "7Networks_LH_DorsAttn_Post_7"      "7Networks_LH_DorsAttn_Post_9"     
## [11] "7Networks_LH_DorsAttn_Post_11"     "7Networks_LH_DorsAttn_Post_12"    
## [13] "7Networks_LH_DorsAttn_Post_13"     "7Networks_LH_DorsAttn_FEF_3"      
## [15] "7Networks_LH_SalVentAttn_FrOper_9" "7Networks_LH_SalVentAttn_PFCl_1"  
## [17] "7Networks_LH_SalVentAttn_Med_7"    "7Networks_LH_Cont_Par_2"          
## [19] "7Networks_LH_Cont_Par_6"           "7Networks_LH_Cont_PFCl_2"         
## [21] "7Networks_LH_Cont_PFCl_4"          "7Networks_LH_Cont_PFCl_7"         
## [23] "7Networks_LH_Cont_PFCl_8"          "7Networks_LH_Cont_PFCmp_1"        
## [25] "7Networks_LH_Default_Temp_1"       "7Networks_LH_Default_Temp_12"     
## [27] "7Networks_LH_Default_Temp_15"      "7Networks_LH_Default_PFC_1"       
## [29] "7Networks_LH_Default_PFC_2"        "7Networks_LH_Default_PFC_5"       
## [31] "7Networks_LH_Default_PFC_9"        "7Networks_LH_Default_PCC_6"       
## [33] "7Networks_LH_Default_PCC_7"        "7Networks_RH_Vis_6"               
## [35] "7Networks_RH_Vis_11"               "7Networks_RH_Vis_15"              
## [37] "7Networks_RH_Vis_19"               "7Networks_RH_Vis_22"              
## [39] "7Networks_RH_Vis_26"               "7Networks_RH_DorsAttn_Post_4"     
## [41] "7Networks_RH_DorsAttn_Post_9"      "7Networks_RH_DorsAttn_Post_11"    
## [43] "7Networks_RH_DorsAttn_Post_12"     "7Networks_RH_DorsAttn_Post_15"    
## [45] "7Networks_RH_DorsAttn_Post_16"     "7Networks_RH_DorsAttn_Post_17"    
## [47] "7Networks_RH_DorsAttn_Post_18"     "7Networks_RH_DorsAttn_FEF_1"      
## [49] "7Networks_RH_DorsAttn_FEF_2"       "7Networks_RH_SalVentAttn_FrOper_6"
## [51] "7Networks_RH_SalVentAttn_FrOper_7" "7Networks_RH_SalVentAttn_FrOper_8"
## [53] "7Networks_RH_SalVentAttn_Med_2"    "7Networks_RH_Cont_Par_2"          
## [55] "7Networks_RH_Cont_Par_4"           "7Networks_RH_Cont_Par_5"          
## [57] "7Networks_RH_Cont_Par_6"           "7Networks_RH_Cont_PFCl_8"         
## [59] "7Networks_RH_Cont_Cing_1"          "7Networks_RH_Default_Par_4"       
## [61] "7Networks_RH_Default_Temp_1"       "7Networks_RH_Default_Temp_2"      
## [63] "7Networks_RH_Default_PFCm_3"       "7Networks_RH_Default_PFCm_9"
sig_LOO <- load_effect_LOO[,LOO_results$sig_corrected]

visual <- sig_LOO[,c(1:7,34:39)]
dorsal_attn <- sig_LOO[,c(8:14,40:49)]
ventral_attn <- sig_LOO[,c(15:17,50:53)]
FPCN <- sig_LOO[,c(18:23,54:59)]
DMN <- sig_LOO[,c(25:33,61:64)]

network_avg_LOO <- data.frame(visual=rowMeans(visual), DAN = rowMeans(dorsal_attn), VAN = rowMeans(ventral_attn), FPCN = rowMeans(FPCN), DMN = rowMeans(DMN))

LOO - all subjects

data_for_plot <- data.frame(network_avg_LOO, PTID = constructs_fMRI$PTID, BPRS = p200_clinical_zscores$BPRS_TOT[p200_clinical_zscores$PTID %in% constructs_fMRI$PTID], L3_acc = p200_data$XDFR_MRI_ACC_L3[p200_data$PTID %in% constructs_fMRI$PTID], omnibus_span = constructs_fMRI$omnibus_span_no_DFR_MRI)

data_for_plot$BPRS[data_for_plot$BPRS > 4] <- NA

plot_list <- list()

for (network in seq.int(1,5)){
  for (measure in seq.int(7,9)){
    plot_list[[colnames(data_for_plot)[network]]][[colnames(data_for_plot)[measure]]] <- ggplot(data=data_for_plot, aes_string(x= colnames(data_for_plot)[measure], y = colnames(data_for_plot)[network]))+
      geom_point()+
      stat_smooth(method="lm")+
      theme_classic()
  }
}
  • DAN/L3 acc, trend with BPRS
  • DMN with L3 acc
plot_list[["visual"]][["omnibus_span"]]+ plot_list[["visual"]][["L3_acc"]] + plot_list[["visual"]][["BPRS"]] +
  plot_layout(ncol=2)+
  plot_annotation("Average temporal ISC in Visual ROIs")
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).

for (measure in seq.int(7,9)){
  print(colnames(data_for_plot)[measure])
  print(cor.test(data_for_plot$visual, data_for_plot[,measure]))
}
## [1] "BPRS"
## 
##  Pearson's product-moment correlation
## 
## data:  data_for_plot$visual and data_for_plot[, measure]
## t = -0.77458, df = 167, p-value = 0.4397
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.20890473  0.09195905
## sample estimates:
##         cor 
## -0.05983157 
## 
## [1] "L3_acc"
## 
##  Pearson's product-moment correlation
## 
## data:  data_for_plot$visual and data_for_plot[, measure]
## t = 1.7426, df = 168, p-value = 0.08323
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.01762173  0.27818115
## sample estimates:
##       cor 
## 0.1332459 
## 
## [1] "omnibus_span"
## 
##  Pearson's product-moment correlation
## 
## data:  data_for_plot$visual and data_for_plot[, measure]
## t = 0.13039, df = 168, p-value = 0.8964
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1406681  0.1603306
## sample estimates:
##        cor 
## 0.01005913
plot_list[["FPCN"]][["omnibus_span"]]+ plot_list[["FPCN"]][["L3_acc"]] + plot_list[["FPCN"]][["BPRS"]] +
  plot_layout(ncol=2)+
  plot_annotation("Average temporal ISC in FPCN ROIs")
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).

## Warning: Removed 1 rows containing missing values (geom_point).

for (measure in seq.int(7,9)){
  print(colnames(data_for_plot)[measure])
  print(cor.test(data_for_plot$FPCN, data_for_plot[,measure]))
}
## [1] "BPRS"
## 
##  Pearson's product-moment correlation
## 
## data:  data_for_plot$FPCN and data_for_plot[, measure]
## t = -1.7987, df = 167, p-value = 0.07387
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.28293088  0.01337949
## sample estimates:
##       cor 
## -0.137859 
## 
## [1] "L3_acc"
## 
##  Pearson's product-moment correlation
## 
## data:  data_for_plot$FPCN and data_for_plot[, measure]
## t = 1.1208, df = 168, p-value = 0.264
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.06521038  0.23363422
## sample estimates:
##        cor 
## 0.08614944 
## 
## [1] "omnibus_span"
## 
##  Pearson's product-moment correlation
## 
## data:  data_for_plot$FPCN and data_for_plot[, measure]
## t = 1.011, df = 168, p-value = 0.3135
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.07360969  0.22563932
## sample estimates:
##        cor 
## 0.07776616
plot_list[["DMN"]][["omnibus_span"]]+ plot_list[["DMN"]][["L3_acc"]] + plot_list[["DMN"]][["BPRS"]] +
  plot_layout(ncol=2)+
  plot_annotation("Average temporal ISC in DMN ROIs")
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).

## Warning: Removed 1 rows containing missing values (geom_point).

for (measure in seq.int(7,9)){
  print(colnames(data_for_plot)[measure])
  print(cor.test(data_for_plot$DMN, data_for_plot[,measure]))
}
## [1] "BPRS"
## 
##  Pearson's product-moment correlation
## 
## data:  data_for_plot$DMN and data_for_plot[, measure]
## t = -0.090326, df = 167, p-value = 0.9281
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1577830  0.1441227
## sample estimates:
##          cor 
## -0.006989431 
## 
## [1] "L3_acc"
## 
##  Pearson's product-moment correlation
## 
## data:  data_for_plot$DMN and data_for_plot[, measure]
## t = 2.3467, df = 168, p-value = 0.02011
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.02840307 0.32008683
## sample estimates:
##       cor 
## 0.1781557 
## 
## [1] "omnibus_span"
## 
##  Pearson's product-moment correlation
## 
## data:  data_for_plot$DMN and data_for_plot[, measure]
## t = 1.0827, df = 168, p-value = 0.2805
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.06812651  0.23086306
## sample estimates:
##       cor 
## 0.0832413
plot_list[["DAN"]][["omnibus_span"]]+ plot_list[["DAN"]][["L3_acc"]] + plot_list[["DAN"]][["BPRS"]] +
  plot_layout(ncol=2)+
  plot_annotation("Average temporal ISC in DAN ROIs")
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).

## Warning: Removed 1 rows containing missing values (geom_point).

for (measure in seq.int(7,9)){
  print(colnames(data_for_plot)[measure])
  print(cor.test(data_for_plot$DAN, data_for_plot[,measure]))
}
## [1] "BPRS"
## 
##  Pearson's product-moment correlation
## 
## data:  data_for_plot$DAN and data_for_plot[, measure]
## t = -1.8703, df = 167, p-value = 0.06319
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.287971161  0.007892701
## sample estimates:
##       cor 
## -0.143238 
## 
## [1] "L3_acc"
## 
##  Pearson's product-moment correlation
## 
## data:  data_for_plot$DAN and data_for_plot[, measure]
## t = 2.9392, df = 168, p-value = 0.003754
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.07306722 0.35969089
## sample estimates:
##       cor 
## 0.2211494 
## 
## [1] "omnibus_span"
## 
##  Pearson's product-moment correlation
## 
## data:  data_for_plot$DAN and data_for_plot[, measure]
## t = 1.5391, df = 168, p-value = 0.1257
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.03318511  0.26375122
## sample estimates:
##       cor 
## 0.1179181
plot_list[["VAN"]][["omnibus_span"]]+ plot_list[["VAN"]][["L3_acc"]] + plot_list[["VAN"]][["BPRS"]] +
  plot_layout(ncol=2)+
  plot_annotation("Average temporal ISC in VAN ROIs")
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).

## Warning: Removed 1 rows containing missing values (geom_point).

for (measure in seq.int(7,9)){
  print(colnames(data_for_plot)[measure])
  print(cor.test(data_for_plot$VAN, data_for_plot[,measure]))
}
## [1] "BPRS"
## 
##  Pearson's product-moment correlation
## 
## data:  data_for_plot$VAN and data_for_plot[, measure]
## t = -1.6153, df = 167, p-value = 0.1081
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.26993505  0.02744475
## sample estimates:
##        cor 
## -0.1240291 
## 
## [1] "L3_acc"
## 
##  Pearson's product-moment correlation
## 
## data:  data_for_plot$VAN and data_for_plot[, measure]
## t = 0.20117, df = 168, p-value = 0.8408
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1353115  0.1656461
## sample estimates:
##        cor 
## 0.01551879 
## 
## [1] "omnibus_span"
## 
##  Pearson's product-moment correlation
## 
## data:  data_for_plot$VAN and data_for_plot[, measure]
## t = 1.464, df = 168, p-value = 0.1451
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.03893637  0.25838497
## sample estimates:
##       cor 
## 0.1122356

Pairwise

Here, we’re going to do the background calculations look at all the pairwise comparisons of subjects within each network.

high_pairwise_sig <- high_correct_ISC_pairwise[,,LOO_results$sig_corrected]
low_pairwise_sig <- low_correct_ISC_pairwise[,,LOO_results$sig_corrected]
load_effect_pairwise <- high_pairwise_sig - low_pairwise_sig

visual_pairwise_L3 <- high_pairwise_sig[,,c(1:7,34:39)]
dorsal_attn_pairwise_L3 <- high_pairwise_sig[,,c(8:14,40:49)]
ventral_attn_pairwise_L3 <- high_pairwise_sig[,,c(15:17,50:53)]
FPCN_pairwise_L3 <- high_pairwise_sig[,,c(18:23,54:59)]
DMN_pairwise_L3 <- high_pairwise_sig[,,c(25:33,61:64)]

network_pairwise_high_load <- list(visual = apply(visual_pairwise_L3, c(1,2), mean), FPCN = apply(FPCN_pairwise_L3, c(1,2), mean), DMN = apply(DMN_pairwise_L3, c(1,2), mean), DAN = apply(dorsal_attn_pairwise_L3, c(1,2), mean), VAN = apply(ventral_attn_pairwise_L3, c(1,2), mean))

visual_pairwise <- load_effect_pairwise[,,c(1:7,34:39)]
dorsal_attn_pairwise <- load_effect_pairwise[,,c(8:14,40:49)]
ventral_attn_pairwise <- load_effect_pairwise[,,c(15:17,50:53)]
FPCN_pairwise <- load_effect_pairwise[,,c(18:23,54:59)]
DMN_pairwise <- load_effect_pairwise[,,c(25:33,61:64)]

network_pairwise <- list(visual = apply(visual_pairwise, c(1,2), mean), FPCN = apply(FPCN_pairwise, c(1,2), mean), 
                         DMN = apply(DMN_pairwise, c(1,2), mean), DAN = apply(dorsal_attn_pairwise, c(1,2), mean), 
                         VAN = apply(ventral_attn_pairwise, c(1,2), mean))
# reorder based on span 
span_order <- order(constructs_fMRI$omnibus_span_no_DFR_MRI)

network_pairwise_span_ordered_high_load <- list()
network_pairwise_span_ordered <- list()
for (network in seq.int(1,5)){
  network_pairwise_span_ordered_high_load[[network]] <- network_pairwise_high_load[[network]][span_order, span_order]
  network_pairwise_span_ordered[[network]] <- network_pairwise[[network]][span_order, span_order]
}
network_graphs_high_load <- list()

for (network in seq.int(1,5)){
  data <- data.frame(network_pairwise_span_ordered_high_load[[network]][,])
  rownames(data) <- c(1:170)
  colnames(data) <- c(1:170)
  data %>%
    
    # Data wrangling
    as_tibble() %>%
    rowid_to_column(var="X") %>%
    gather(key="Y", value="Z", -1) %>% 
    
    # Change Y to numeric
    mutate(Y=as.numeric(gsub("V","",Y))) -> mutated_data
  # 
  ggplot(data=mutated_data,aes(X, Y, fill= Z)) +
    geom_tile() +
    scale_y_continuous(breaks = c(0,50,100,150),labels=c(0,50,100,150))+
    geom_hline(yintercept=57,color="black")+
    geom_hline(yintercept=114,color="black")+
    geom_vline(xintercept=57,color="black")+
    geom_vline(xintercept=114,color="black")+
    scale_fill_gradient2()+
    theme(aspect=1)+
    labs(fill="ISC")+
    ggtitle(paste("network:",names(network_pairwise)[network]))-> network_graphs_high_load[[network]]
}
network_graphs_load_effect <- list()

for (network in seq.int(1,5)){
  data <- data.frame(network_pairwise_span_ordered[[network]][,])
  rownames(data) <- c(1:170)
  colnames(data) <- c(1:170)
  data %>%
    
    # Data wrangling
    as_tibble() %>%
    rowid_to_column(var="X") %>%
    gather(key="Y", value="Z", -1) %>% 
    
    # Change Y to numeric
    mutate(Y=as.numeric(gsub("V","",Y))) -> mutated_data
  # 
  ggplot(data=mutated_data,aes(X, Y, fill= Z)) +
    geom_tile() +
    scale_y_continuous(breaks = c(0,50,100,150),labels=c(0,50,100,150))+
    geom_hline(yintercept=57,color="black")+
    geom_hline(yintercept=114,color="black")+
    geom_vline(xintercept=57,color="black")+
    geom_vline(xintercept=114,color="black")+
    scale_fill_gradient2()+
    theme(aspect=1)+
    labs(fill="Load Effect")+
    ggtitle(paste("network:",names(network_pairwise)[network]))-> network_graphs_load_effect[[network]]
}

High Load

Visualize pairwise comparisons

Let’s visualize the pairwise intersubject correlations for each network. Black lines here represent distinctions between working memory capacity groups.

network_graphs_high_load[[1]] 

network_graphs_high_load[[2]] 

network_graphs_high_load[[3]] 

network_graphs_high_load[[4]] 

network_graphs_high_load[[5]] 

t_test_res = data.frame(matrix(nrow=5,ncol=2)) 
colnames(t_test_res) <- c("t value","p value")
cols <- c("low_within","low_across","med_within","med_across","high_within","high_across")

group_means <- data.frame(matrix(nrow=5,ncol=6))
colnames(group_means) <- cols

group_se <- data.frame(matrix(nrow=5,ncol=6))
colnames(group_se) <- cols

avg_over_groups<- list(mean=data.frame(within = matrix(nrow=5,ncol=1),across = matrix(nrow=5,ncol=1)),
                       se=data.frame(within = matrix(nrow=5,ncol=1),across = matrix(nrow=5,ncol=1)))

split_list <- list()
all_ISC_list_high_load <- list()

for (network in seq.int(1:5)){
  
  # define dataframes 
  comps <- data.frame(within = matrix(nrow=170,ncol=1),across = matrix(nrow=170,ncol=1))
  
  split_by_groups <- data.frame(matrix(nrow=56,ncol=6))
  colnames(split_by_groups) <- cols
  
  # loop over all subjects and make comparisons
  for (suj in c(1:56, 58:113, 115:170)){
    if (suj < 57){
      comps$within[suj] <- mean(network_pairwise_span_ordered_high_load[[network]][1:56,suj],na.rm=TRUE)
      comps$across[suj] <- mean(network_pairwise_span_ordered_high_load[[network]][c(58:113,115:170),suj],na.rm=TRUE)
    }else if (suj > 57 & suj < 114){ 
      comps$within[suj] <- mean(network_pairwise_span_ordered_high_load[[network]][58:113,suj],na.rm=TRUE)
      comps$across[suj] <- mean(network_pairwise_span_ordered_high_load[[network]][c(1:56,115:170),suj],na.rm=TRUE)
    }else if (suj > 114){ 
      comps$within[suj] <- mean(network_pairwise_span_ordered_high_load[[network]][115:170,suj],na.rm=TRUE)
      comps$across[suj] <- mean(network_pairwise_span_ordered_high_load[[network]][c(1:56,58:113),suj],na.rm=TRUE)}
    
  }
  all_ISC_list_high_load[[names(network_pairwise)[network]]] <- comps 
  
  # average over groups 
  avg_over_groups[["mean"]]$within[network] <- mean(comps$within, na.rm=TRUE)
  avg_over_groups[["mean"]]$across[network] <- mean(comps$across, na.rm=TRUE)
  avg_over_groups[["se"]]$within[network] <- se(comps$within)
  avg_over_groups[["se"]]$across[network] <- se(comps$across)
  
  avg_over_groups[["mean"]]$difference[network] <- avg_over_groups[["mean"]]$within[network] - avg_over_groups[["mean"]]$across[network]
  avg_over_groups[["se"]]$difference[network] <- se(comps$within - comps$across)
  
  # split by groups 
  split_by_groups$low_across <- comps$across[1:56]
  split_by_groups$low_within <- comps$within[1:56]
  
  split_by_groups$med_across <- comps$across[58:113]
  split_by_groups$med_within <- comps$within[58:113]
  
  split_by_groups$high_across <- comps$across[115:170]
  split_by_groups$high_within <- comps$within[115:170]
  
  split_list[[names(network_pairwise)[network]]] <- split_by_groups
  
  group_means[network,] <- colMeans(split_by_groups)
  for (group in seq.int(1,6)){
    group_se[network,group] <- se(split_by_groups[,group])
  }
  temp2 <- t.test(comps$within,comps$across,paired=TRUE,var.equal = FALSE)
  t_test_res[network,] <- c(temp2$statistic,temp2$p.value)
  
}

rownames(t_test_res) <- names(network_pairwise) 

Here, we’re looking to see whether there are significant differences within vs across WMC groups. Visual regions, DMN and DAN regions all show differences within vs across groups.

print(t_test_res)
##           t value      p value
## visual -5.0995924 9.155685e-07
## FPCN    1.7065772 8.975943e-02
## DMN     2.4082910 1.711611e-02
## DAN    -3.1638297 1.850336e-03
## VAN    -0.3083997 7.581626e-01
bar_list <- list()
bar_plot_data <- data.frame(matrix(nrow = 30, ncol=7))
colnames(bar_plot_data) <- c("mean", "se", "network_name", "comparison", "WMC", "err_min", "err_max")
comparison_list <- c("within", "across")
WMC_list <- c("low", "med", "high")
row_count=1
#row for mean, se, network, comparison, WMC
for (network in seq.int(1,5)){
  for (WMC in seq.int(1,3)){
    for (comparison in seq.int(1,2)){
      col_to_look <- ((WMC-1)*2+1) + (comparison-1)
      bar_plot_data$mean[row_count] <- mean(split_list[[network]][,col_to_look])  
      bar_plot_data$se[row_count] <- group_se[network,col_to_look]
      bar_plot_data$err_min[row_count] <- bar_plot_data$mean[row_count] - bar_plot_data$se[row_count]
      bar_plot_data$err_max[row_count] <- bar_plot_data$mean[row_count] + bar_plot_data$se[row_count]
      bar_plot_data$network_name[row_count] <- names(network_pairwise)[network]
      bar_plot_data$comparison[row_count] <- comparison_list[comparison] 
      bar_plot_data$WMC[row_count] <- WMC_list[WMC]
      row_count = row_count+1
    }
  }
  
  bar_plot_data$comparison <- as.factor(bar_plot_data$comparison)
  bar_plot_data$WMC <- factor(bar_plot_data$WMC, levels=c("low", "med", "high"))
  
  bar_plot_data %>%
    filter(network_name == names(network_pairwise)[network]) %>%
    ggplot(aes(x=WMC, y= mean, fill=comparison))+
    geom_bar(stat="identity", position="dodge")+
    geom_errorbar(aes(ymin=err_min, ymax=err_max), position=position_dodge(0.9), width=0.2)+
    ylab("Mean ISC")+
    ggtitle(paste0("network:", names(network_pairwise)[network])) -> bar_list[[names(network_pairwise)[network]]]
  
  
}

Average over subjects

The visual network, DMN and DAN show a significant effect of comparison, but no main effect of WMC. For the visual network and the DAN, across group comparisons show stronger ISC than within group. For the DMN, within group comparisons show stronger ISC than across group. In contrast, the FPCN only shows an effect of WMC group, where high capacity subjects show stronger ISC (regardless of comparison) than either low or medium WMC subjects, but no effect of comparison.

(bar_list[["visual"]] + bar_list[["FPCN"]]) +
  plot_layout(guides="collect")

(bar_list[["DMN"]]+ bar_list[["DAN"]])+
  plot_layout(guides="collect")

bar_list[["VAN"]] 

anova_split_high_load_data <- list()

for (network in seq.int(1,5)){
  temp <- melt(split_list[[network]])
  temp$variable <- as.character(temp$variable)
  temp$ID <- c(1:56)
  
  for (row in seq.int(1,nrow(temp))){
    split <- strsplit(temp$variable[row], split="_")[[1]]
    temp$WMC[row] <- split[1]
    temp$comp[row] <- split[2]
    
  }
  colnames(temp)[1:2] <- c("unsplit", "ISC")
  temp$WMC <- factor(temp$WMC, levels = c("low","med", "high"))
  temp$comp <- factor(temp$comp, levels = c("within", "across"))
  temp$ID <- as.factor(temp$ID)
  
  anova_split_high_load_data[[names(split_list)[network]]] <- temp
  print(names(split_list)[network])
  res.aov <- aov(ISC ~ WMC*comp + Error(ID/comp), data = anova_split_high_load_data[[network]])
  print(summary(res.aov))
}
## No id variables; using all as measure variables
## [1] "visual"
## 
## Error: ID
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals 55  2.286 0.04157               
## 
## Error: ID:comp
##           Df   Sum Sq  Mean Sq F value   Pr(>F)    
## comp       1 0.009848 0.009848   54.25 9.51e-10 ***
## Residuals 55 0.009985 0.000182                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Error: Within
##            Df Sum Sq Mean Sq F value Pr(>F)
## WMC         2  0.087 0.04361   1.357  0.260
## WMC:comp    2  0.033 0.01663   0.517  0.597
## Residuals 220  7.069 0.03213
## No id variables; using all as measure variables
## [1] "FPCN"
## 
## Error: ID
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals 55  0.489 0.00889               
## 
## Error: ID:comp
##           Df  Sum Sq  Mean Sq F value Pr(>F)  
## comp       1 0.00324 0.003243   3.001 0.0888 .
## Residuals 55 0.05944 0.001081                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Error: Within
##            Df Sum Sq Mean Sq F value  Pr(>F)    
## WMC         2 0.1253 0.06264   8.972 0.00018 ***
## WMC:comp    2 0.0303 0.01514   2.169 0.11675    
## Residuals 220 1.5360 0.00698                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## No id variables; using all as measure variables
## [1] "DMN"
## 
## Error: ID
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals 55 0.6181 0.01124               
## 
## Error: ID:comp
##           Df  Sum Sq  Mean Sq F value Pr(>F)  
## comp       1 0.00767 0.007670   6.759  0.012 *
## Residuals 55 0.06242 0.001135                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Error: Within
##            Df Sum Sq  Mean Sq F value Pr(>F)
## WMC         2 0.0064 0.003208   0.688  0.504
## WMC:comp    2 0.0099 0.004955   1.062  0.348
## Residuals 220 1.0266 0.004666
## No id variables; using all as measure variables
## [1] "DAN"
## 
## Error: ID
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals 55  1.359 0.02472               
## 
## Error: ID:comp
##           Df   Sum Sq  Mean Sq F value   Pr(>F)    
## comp       1 0.003994 0.003994   13.21 0.000614 ***
## Residuals 55 0.016633 0.000302                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Error: Within
##            Df Sum Sq  Mean Sq F value Pr(>F)
## WMC         2  0.053 0.026622   1.523   0.22
## WMC:comp    2  0.018 0.008937   0.511   0.60
## Residuals 220  3.845 0.017477
## No id variables; using all as measure variables
## [1] "VAN"
## 
## Error: ID
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals 55  0.945 0.01718               
## 
## Error: ID:comp
##           Df  Sum Sq   Mean Sq F value Pr(>F)
## comp       1 0.00007 0.0000678   0.102   0.75
## Residuals 55 0.03650 0.0006637               
## 
## Error: Within
##            Df Sum Sq  Mean Sq F value Pr(>F)
## WMC         2 0.0159 0.007928   0.669  0.513
## WMC:comp    2 0.0046 0.002279   0.192  0.825
## Residuals 220 2.6055 0.011843
FPCN.aov <- aov(ISC ~ WMC, data= anova_split_high_load_data[["FPCN"]])
TukeyHSD(FPCN.aov)
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = ISC ~ WMC, data = anova_split_high_load_data[["FPCN"]])
## 
## $WMC
##                  diff         lwr        upr     p adj
## med-low  -0.006174274 -0.03126396 0.01891541 0.8312553
## high-low  0.037524183  0.01243450 0.06261386 0.0014188
## high-med  0.043698458  0.01860878 0.06878814 0.0001532

Compare to behavior

  • VAN - both to acc; trend to span within
  • DAN - both to acc; trend to span within
  • DMN - both to acc; across to span
  • FPCN: across to acc; within to span
  • visual: both to acc
for (network in seq.int(1,5)){
  data_to_plot <- data.frame(constructs_fMRI[span_order, c(1,7)], all_ISC_list_high_load[[network]])
  data_to_plot <- merge(data_to_plot, p200_clinical_zscores[,c(1,2,8)], by="PTID")
  data_to_plot <- merge(data_to_plot, p200_data[,c(1,7)], by="PTID")
  data_to_plot$BPRS_TOT[data_to_plot$BPRS_TOT > 4] <- NA
  
  
  print(names(network_pairwise)[network])
  
  print(ggplot(data = data_to_plot)+
          geom_point(aes(x=omnibus_span_no_DFR_MRI,y=within), fill="black")+
          geom_smooth(aes(x=omnibus_span_no_DFR_MRI,y=within), method="lm", color="black")+
          geom_point(aes(x=omnibus_span_no_DFR_MRI,y=across), color="red")+
          geom_smooth(aes(x=omnibus_span_no_DFR_MRI,y=across), method="lm", color="red")+
          ylab("ISC")+
          ggtitle(paste0("network: "), names(network_pairwise)[network]))
  
  print(cor.test(data_to_plot$omnibus_span_no_DFR_MRI, data_to_plot$within))
  print(cor.test(data_to_plot$omnibus_span_no_DFR_MRI, data_to_plot$across))
  
  
  print(ggplot(data = data_to_plot)+
          geom_point(aes(x=BPRS_TOT,y=within), fill="black")+
          geom_smooth(aes(x=BPRS_TOT,y=within), method="lm", color="black")+
          geom_point(aes(x=BPRS_TOT,y=across), color="red")+
          geom_smooth(aes(x=BPRS_TOT,y=across), method="lm", color="red")+
          ylab("ISC")+
          ggtitle(paste0("network: "), names(network_pairwise)[network]))
  
  print(cor.test(data_to_plot$BPRS_TOT, data_to_plot$within))
  print(cor.test(data_to_plot$BPRS_TOT, data_to_plot$across))
  
  print(ggplot(data = data_to_plot)+
          geom_point(aes(x=XDFR_MRI_ACC_L3,y=within), fill="black")+
          geom_smooth(aes(x=XDFR_MRI_ACC_L3,y=within), method="lm", color="black")+
          geom_point(aes(x=XDFR_MRI_ACC_L3,y=across), color="red")+
          geom_smooth(aes(x=XDFR_MRI_ACC_L3,y=across), method="lm", color="red")+
          ylab("ISC")+
          ggtitle(paste0("network: "), names(network_pairwise)[network]))
  
  print(cor.test(data_to_plot$XDFR_MRI_ACC_L3, data_to_plot$within))
  print(cor.test(data_to_plot$XDFR_MRI_ACC_L3, data_to_plot$across))
  
  
}
## [1] "visual"

## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$omnibus_span_no_DFR_MRI and data_to_plot$within
## t = 1.6012, df = 166, p-value = 0.1112
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.02861651  0.26970129
## sample estimates:
##       cor 
## 0.1233276 
## 
## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$omnibus_span_no_DFR_MRI and data_to_plot$across
## t = 0.65654, df = 166, p-value = 0.5124
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1012987  0.2007545
## sample estimates:
##        cor 
## 0.05089162

## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$BPRS_TOT and data_to_plot$within
## t = -1.2962, df = 165, p-value = 0.1967
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.24847402  0.05226153
## sample estimates:
##        cor 
## -0.1003989 
## 
## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$BPRS_TOT and data_to_plot$across
## t = -1.062, df = 165, p-value = 0.2898
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.23136068  0.07035191
## sample estimates:
##         cor 
## -0.08239195

## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$XDFR_MRI_ACC_L3 and data_to_plot$within
## t = 4.8281, df = 166, p-value = 3.11e-06
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.2106881 0.4769721
## sample estimates:
##      cor 
## 0.350904 
## 
## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$XDFR_MRI_ACC_L3 and data_to_plot$across
## t = 4.3218, df = 166, p-value = 2.659e-05
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.1750428 0.4478680
## sample estimates:
##       cor 
## 0.3180239 
## 
## [1] "FPCN"

## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$omnibus_span_no_DFR_MRI and data_to_plot$within
## t = 3.5301, df = 166, p-value = 0.0005378
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.1175399 0.3996663
## sample estimates:
##       cor 
## 0.2642469 
## 
## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$omnibus_span_no_DFR_MRI and data_to_plot$across
## t = 0.72207, df = 166, p-value = 0.4713
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.09626941  0.20562368
## sample estimates:
##      cor 
## 0.055956

## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$BPRS_TOT and data_to_plot$within
## t = -0.23681, df = 165, p-value = 0.8131
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1698207  0.1338057
## sample estimates:
##         cor 
## -0.01843248 
## 
## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$BPRS_TOT and data_to_plot$across
## t = -0.49557, df = 165, p-value = 0.6209
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1893063  0.1139799
## sample estimates:
##         cor 
## -0.03855101

## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$XDFR_MRI_ACC_L3 and data_to_plot$within
## t = 1.7854, df = 166, p-value = 0.07602
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.01444652  0.28279595
## sample estimates:
##       cor 
## 0.1372635 
## 
## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$XDFR_MRI_ACC_L3 and data_to_plot$across
## t = 2.284, df = 166, p-value = 0.02364
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.02376943 0.31756789
## sample estimates:
##      cor 
## 0.174551 
## 
## [1] "DMN"

## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$omnibus_span_no_DFR_MRI and data_to_plot$within
## t = 1.3469, df = 166, p-value = 0.1798
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.04819519  0.25142502
## sample estimates:
##       cor 
## 0.1039733 
## 
## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$omnibus_span_no_DFR_MRI and data_to_plot$across
## t = -0.3589, df = 166, p-value = 0.7201
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1785022  0.1240880
## sample estimates:
##         cor 
## -0.02784499

## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$BPRS_TOT and data_to_plot$within
## t = -1.2239, df = 165, p-value = 0.2227
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.24321220  0.05784485
## sample estimates:
##         cor 
## -0.09485197 
## 
## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$BPRS_TOT and data_to_plot$across
## t = -1.1393, df = 165, p-value = 0.2562
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.23702809  0.06438283
## sample estimates:
##         cor 
## -0.08834454

## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$XDFR_MRI_ACC_L3 and data_to_plot$within
## t = 3.6711, df = 166, p-value = 0.0003253
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.1279205 0.4084847
## sample estimates:
##       cor 
## 0.2740229 
## 
## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$XDFR_MRI_ACC_L3 and data_to_plot$across
## t = 3.9015, df = 166, p-value = 0.0001386
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.1447645 0.4226834
## sample estimates:
##       cor 
## 0.2898217 
## 
## [1] "DAN"

## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$omnibus_span_no_DFR_MRI and data_to_plot$within
## t = 1.8431, df = 166, p-value = 0.06709
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.01001055  0.28687263
## sample estimates:
##       cor 
## 0.1416139 
## 
## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$omnibus_span_no_DFR_MRI and data_to_plot$across
## t = 0.34612, df = 166, p-value = 0.7297
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1250638  0.1775424
## sample estimates:
##        cor 
## 0.02685449

## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$BPRS_TOT and data_to_plot$within
## t = -0.44108, df = 165, p-value = 0.6597
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1852164  0.1181613
## sample estimates:
##        cor 
## -0.0343181 
## 
## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$BPRS_TOT and data_to_plot$across
## t = -0.31544, df = 165, p-value = 0.7528
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1757579  0.1277905
## sample estimates:
##         cor 
## -0.02454957

## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$XDFR_MRI_ACC_L3 and data_to_plot$within
## t = 4.4445, df = 166, p-value = 1.605e-05
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.1837685 0.4550463
## sample estimates:
##       cor 
## 0.3261046 
## 
## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$XDFR_MRI_ACC_L3 and data_to_plot$across
## t = 4.2078, df = 166, p-value = 4.212e-05
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.1668847 0.4411247
## sample estimates:
##     cor 
## 0.31045 
## 
## [1] "VAN"

## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$omnibus_span_no_DFR_MRI and data_to_plot$within
## t = 1.921, df = 166, p-value = 0.05645
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.004034671  0.292347552
## sample estimates:
##       cor 
## 0.1474652 
## 
## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$omnibus_span_no_DFR_MRI and data_to_plot$across
## t = 0.99438, df = 166, p-value = 0.3215
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.07533739  0.22572996
## sample estimates:
##        cor 
## 0.07695015

## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$BPRS_TOT and data_to_plot$within
## t = -0.64558, df = 165, p-value = 0.5194
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.2005299  0.1024497
## sample estimates:
##         cor 
## -0.05019486 
## 
## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$BPRS_TOT and data_to_plot$across
## t = -0.56907, df = 165, p-value = 0.5701
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1948131  0.1083328
## sample estimates:
##         cor 
## -0.04425894

## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$XDFR_MRI_ACC_L3 and data_to_plot$within
## t = 1.9777, df = 166, p-value = 0.04962
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.0003166685 0.2963219344
## sample estimates:
##       cor 
## 0.1517192 
## 
## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$XDFR_MRI_ACC_L3 and data_to_plot$across
## t = 2.2328, df = 166, p-value = 0.0269
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.01985964 0.31404637
## sample estimates:
##      cor 
## 0.170756

Load Effects

Visualize pairs

network_graphs_load_effect[[1]] 

network_graphs_load_effect[[2]] 

network_graphs_load_effect[[3]] 

network_graphs_load_effect[[4]] 

network_graphs_load_effect[[5]] 

t_test_res = data.frame(matrix(nrow=5,ncol=2)) 
colnames(t_test_res) <- c("t value","p value")
cols <- c("low_within","low_across","med_within","med_across","high_within","high_across")

group_means <- data.frame(matrix(nrow=5,ncol=6))
colnames(group_means) <- cols

group_se <- data.frame(matrix(nrow=5,ncol=6))
colnames(group_se) <- cols

avg_over_groups<- list(mean=data.frame(within = matrix(nrow=5,ncol=1),across = matrix(nrow=5,ncol=1)),
                       se=data.frame(within = matrix(nrow=5,ncol=1),across = matrix(nrow=5,ncol=1)))

split_list <- list()

all_ISC_list_LE <- list()

for (network in seq.int(1:5)){
  
  # define dataframes 
  comps <- data.frame(within = matrix(nrow=170,ncol=1),across = matrix(nrow=170,ncol=1))
  
  split_by_groups <- data.frame(matrix(nrow=56,ncol=6))
  colnames(split_by_groups) <- cols
  
  # loop over all subjects and make comparisons
  for (suj in c(1:56, 58:113, 115:170)){
    if (suj < 57){
      comps$within[suj] <- mean(network_pairwise_span_ordered[[network]][1:56,suj],na.rm=TRUE)
      comps$across[suj] <- mean(network_pairwise_span_ordered[[network]][c(58:113,115:170),suj],na.rm=TRUE)
    }else if (suj > 57 & suj < 114){ 
      comps$within[suj] <- mean(network_pairwise_span_ordered[[network]][58:113,suj],na.rm=TRUE)
      comps$across[suj] <- mean(network_pairwise_span_ordered[[network]][c(1:56,115:170),suj],na.rm=TRUE)
    }else if (suj > 114){ 
      comps$within[suj] <- mean(network_pairwise_span_ordered[[network]][115:170,suj],na.rm=TRUE)
      comps$across[suj] <- mean(network_pairwise_span_ordered[[network]][c(1:56,58:113),suj],na.rm=TRUE)
    }
  }
  
  all_ISC_list_LE[[names(network_pairwise)[network]]] <- comps 
  
  
  # average over groups 
  avg_over_groups[["mean"]]$within[network] <- mean(comps$within, na.rm=TRUE)
  avg_over_groups[["mean"]]$across[network] <- mean(comps$across, na.rm=TRUE)
  avg_over_groups[["se"]]$within[network] <- se(comps$within)
  avg_over_groups[["se"]]$across[network] <- se(comps$across)
  
  avg_over_groups[["mean"]]$difference[network] <- avg_over_groups[["mean"]]$within[network] - avg_over_groups[["mean"]]$across[network]
  avg_over_groups[["se"]]$difference[network] <- se(comps$within - comps$across)
  
  # split by groups 
  split_by_groups$low_across <- comps$across[1:56]
  split_by_groups$low_within <- comps$within[1:56]
  
  split_by_groups$med_across <- comps$across[58:113]
  split_by_groups$med_within <- comps$within[58:113]
  
  split_by_groups$high_across <- comps$across[115:170]
  split_by_groups$high_within <- comps$within[115:170]
  
  split_list[[names(network_pairwise)[network]]] <- split_by_groups
  
  group_means[network,] <- colMeans(split_by_groups)
  for (group in seq.int(1,6)){
    group_se[network,group] <- se(split_by_groups[,group])
  }
  temp2 <- t.test(comps$within,comps$across,paired=TRUE,var.equal = FALSE)
  t_test_res[network,] <- c(temp2$statistic,temp2$p.value)
  
}

rownames(t_test_res) <- names(network_pairwise) 

Looking at the load effects, we only see differences in within vs across WMC groups for the FPCN.

print(t_test_res)
##           t value     p value
## visual -1.0877393 0.278277558
## FPCN    3.3130726 0.001131379
## DMN     1.1234601 0.262854555
## DAN    -0.8727005 0.384079386
## VAN     1.6959284 0.091762824

Compare across groups

bar_list <- list()
bar_plot_data <- data.frame(matrix(nrow = 30, ncol=7))
colnames(bar_plot_data) <- c("mean", "se", "network_name", "comparison", "WMC", "err_min", "err_max")
comparison_list <- c("within", "across")
WMC_list <- c("low", "med", "high")
row_count=1
#row for mean, se, network, comparison, WMC
for (network in seq.int(1,5)){
  for (WMC in seq.int(1,3)){
    for (comparison in seq.int(1,2)){
      col_to_look <- ((WMC-1)*2+1) + (comparison-1)
      bar_plot_data$mean[row_count] <- mean(split_list[[network]][,col_to_look])  
      bar_plot_data$se[row_count] <- group_se[network,col_to_look]
      bar_plot_data$err_min[row_count] <- bar_plot_data$mean[row_count] - bar_plot_data$se[row_count]
      bar_plot_data$err_max[row_count] <- bar_plot_data$mean[row_count] + bar_plot_data$se[row_count]
      bar_plot_data$network_name[row_count] <- names(network_pairwise)[network]
      bar_plot_data$comparison[row_count] <- comparison_list[comparison] 
      bar_plot_data$WMC[row_count] <- WMC_list[WMC]
      row_count = row_count+1
    }
  }
  
  bar_plot_data$comparison <- as.factor(bar_plot_data$comparison)
  bar_plot_data$WMC <- factor(bar_plot_data$WMC, levels=c("low", "med", "high"))
  
  bar_plot_data %>%
    filter(network_name == names(network_pairwise)[network]) %>%
    ggplot(aes(x=WMC, y= mean, fill=comparison))+
    geom_bar(stat="identity", position="dodge")+
    geom_errorbar(aes(ymin=err_min, ymax=err_max), position=position_dodge(0.9), width=0.2)+
    ylab("Mean ISC")+
    ggtitle(paste0("network:", names(network_pairwise)[network])) -> bar_list[[names(network_pairwise)[network]]]
  
  
}

For the load effects, FPCN shows main effects of both WMC and comparison, but does not show an interaction. DAN just shows a main effect of WMC.

In the FPCN, we see that high capacity subjects show stronger ISCs than medium or low WMC subjects. However, because this is load effects and the values themselves are negative, this suggests that for high WMC subjects, there is less of a difference between high and load load ISC, while in the medium and low WMC subjects, we see stronger ISC in the low load trials. The within subject main effect tells us that there is a more negative load effect in teh across subject condition, suggesting that there tends to be a larger ISC in the low load trials than high load trials when you compare out of WMC group.

For the DAN, we see that high WMC subjects show larger ISC load effects than low WMC subjects, suggesting that there is a larger difference in ISC in the high load trials than low load trials, and that ISC is stronger here in the high load trials.

(bar_list[["visual"]] + bar_list[["FPCN"]]) +
  plot_layout(guides="collect")

(bar_list[["DMN"]]+ bar_list[["DAN"]])+
  plot_layout(guides="collect")

bar_list[["VAN"]] 

anova_split_high_load_data <- list()

for (network in seq.int(1,5)){
  temp <- melt(split_list[[network]])
  temp$variable <- as.character(temp$variable)
  temp$ID <- c(1:56)
  
  for (row in seq.int(1,nrow(temp))){
    split <- strsplit(temp$variable[row], split="_")[[1]]
    temp$WMC[row] <- split[1]
    temp$comp[row] <- split[2]
    
  }
  colnames(temp)[1:2] <- c("unsplit", "ISC")
  temp$WMC <- factor(temp$WMC, levels = c("low","med", "high"))
  temp$comp <- factor(temp$comp, levels = c("within", "across"))
  temp$ID <- as.factor(temp$ID)
  
  anova_split_high_load_data[[names(split_list)[network]]] <- temp
  print(names(split_list)[network])
  res.aov <- aov(ISC ~ WMC*comp + Error(ID/comp), data = anova_split_high_load_data[[network]])
  print(summary(res.aov))
}
## No id variables; using all as measure variables
## [1] "visual"
## 
## Error: ID
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals 55  1.962 0.03568               
## 
## Error: ID:comp
##           Df   Sum Sq   Mean Sq F value Pr(>F)
## comp       1 0.000403 0.0004028   1.253  0.268
## Residuals 55 0.017679 0.0003214               
## 
## Error: Within
##            Df Sum Sq  Mean Sq F value Pr(>F)
## WMC         2  0.017 0.008455   0.498  0.609
## WMC:comp    2  0.006 0.002980   0.175  0.839
## Residuals 220  3.737 0.016984
## No id variables; using all as measure variables
## [1] "FPCN"
## 
## Error: ID
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals 55  1.141 0.02075               
## 
## Error: ID:comp
##           Df  Sum Sq  Mean Sq F value Pr(>F)   
## comp       1 0.01523 0.015232   11.03 0.0016 **
## Residuals 55 0.07597 0.001381                  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Error: Within
##            Df Sum Sq Mean Sq F value  Pr(>F)   
## WMC         2 0.1129 0.05647   5.009 0.00746 **
## WMC:comp    2 0.0245 0.01224   1.085 0.33957   
## Residuals 220 2.4802 0.01127                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## No id variables; using all as measure variables
## [1] "DMN"
## 
## Error: ID
##           Df Sum Sq  Mean Sq F value Pr(>F)
## Residuals 55 0.5277 0.009595               
## 
## Error: ID:comp
##           Df  Sum Sq  Mean Sq F value Pr(>F)
## comp       1 0.00275 0.002747   1.314  0.257
## Residuals 55 0.11496 0.002090               
## 
## Error: Within
##            Df Sum Sq  Mean Sq F value Pr(>F)
## WMC         2 0.0079 0.003934   0.789  0.455
## WMC:comp    2 0.0074 0.003691   0.741  0.478
## Residuals 220 1.0965 0.004984
## No id variables; using all as measure variables
## [1] "DAN"
## 
## Error: ID
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals 55    1.5 0.02727               
## 
## Error: ID:comp
##           Df  Sum Sq   Mean Sq F value Pr(>F)
## comp       1 0.00085 0.0008542   0.981  0.326
## Residuals 55 0.04791 0.0008711               
## 
## Error: Within
##            Df Sum Sq Mean Sq F value Pr(>F)  
## WMC         2 0.1166 0.05828   4.115 0.0176 *
## WMC:comp    2 0.0336 0.01678   1.185 0.3077  
## Residuals 220 3.1161 0.01416                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## No id variables; using all as measure variables
## [1] "VAN"
## 
## Error: ID
##           Df Sum Sq Mean Sq F value Pr(>F)
## Residuals 55  1.583 0.02879               
## 
## Error: ID:comp
##           Df  Sum Sq  Mean Sq F value Pr(>F)  
## comp       1 0.00356 0.003561   3.284 0.0754 .
## Residuals 55 0.05964 0.001084                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Error: Within
##            Df Sum Sq Mean Sq F value Pr(>F)  
## WMC         2  0.087 0.04357   2.546 0.0807 .
## WMC:comp    2  0.026 0.01316   0.769 0.4646  
## Residuals 220  3.765 0.01711                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
FPCN.aov <- aov(ISC ~ WMC, data= anova_split_high_load_data[["FPCN"]])
TukeyHSD(FPCN.aov)
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = ISC ~ WMC, data = anova_split_high_load_data[["FPCN"]])
## 
## $WMC
##                  diff          lwr        upr     p adj
## med-low  -0.005866913 -0.039195397 0.02746157 0.9097113
## high-low  0.035623870  0.002295385 0.06895235 0.0329242
## high-med  0.041490783  0.008162298 0.07481927 0.0100850
DAN.aov <- aov(ISC ~ WMC, data= anova_split_high_load_data[["DAN"]])
TukeyHSD(DAN.aov)
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = ISC ~ WMC, data = anova_split_high_load_data[["DAN"]])
## 
## $WMC
##                 diff          lwr        upr     p adj
## med-low  0.006078554 -0.031290531 0.04344764 0.9223719
## high-low 0.042197856  0.004828771 0.07956694 0.0223561
## high-med 0.036119301 -0.001249784 0.07348839 0.0606787

Relate to behavior

  • visual with acc within
  • FPCN with span/within
  • DMN with acc within and across
  • DAN with span withi; with acc both; both with BPRS if outlier removed
  • VAN within with span
for (network in seq.int(1,5)){
  data_to_plot <- data.frame(constructs_fMRI[span_order, c(1,7)], all_ISC_list_LE[[network]])
  data_to_plot <- merge(data_to_plot, p200_clinical_zscores[,c(1,2,8)], by="PTID")
  data_to_plot <- merge(data_to_plot, p200_data[,c(1,7)], by="PTID")
  data_to_plot$BPRS_TOT[data_to_plot$BPRS_TOT > 4] <- NA
  
  print(names(network_pairwise)[network])
  
  print(ggplot(data = data_to_plot)+
          geom_point(aes(x=omnibus_span_no_DFR_MRI,y=within), fill="black")+
          geom_smooth(aes(x=omnibus_span_no_DFR_MRI,y=within), method="lm", color="black")+
          geom_point(aes(x=omnibus_span_no_DFR_MRI,y=across), color="red")+
          geom_smooth(aes(x=omnibus_span_no_DFR_MRI,y=across), method="lm", color="red")+
          ylab("ISC")+
          ggtitle(paste0("network: "), names(network_pairwise)[network]))
  
  print(cor.test(data_to_plot$omnibus_span_no_DFR_MRI, data_to_plot$within))
  print(cor.test(data_to_plot$omnibus_span_no_DFR_MRI, data_to_plot$across))
  
  
  print(ggplot(data = data_to_plot)+
          geom_point(aes(x=BPRS_TOT,y=within), fill="black")+
          geom_smooth(aes(x=BPRS_TOT,y=within), method="lm", color="black")+
          geom_point(aes(x=BPRS_TOT,y=across), color="red")+
          geom_smooth(aes(x=BPRS_TOT,y=across), method="lm", color="red")+
          ylab("ISC")+
          ggtitle(paste0("network: "), names(network_pairwise)[network]))
  
  print(cor.test(data_to_plot$BPRS_TOT, data_to_plot$within))
  print(cor.test(data_to_plot$BPRS_TOT, data_to_plot$across))
  
  print(ggplot(data = data_to_plot)+
          geom_point(aes(x=XDFR_MRI_ACC_L3,y=within), fill="black")+
          geom_smooth(aes(x=XDFR_MRI_ACC_L3,y=within), method="lm", color="black")+
          geom_point(aes(x=XDFR_MRI_ACC_L3,y=across), color="red")+
          geom_smooth(aes(x=XDFR_MRI_ACC_L3,y=across), method="lm", color="red")+
          ylab("ISC")+
          ggtitle(paste0("network: "), names(network_pairwise)[network]))
  
  print(cor.test(data_to_plot$XDFR_MRI_ACC_L3, data_to_plot$within))
  print(cor.test(data_to_plot$XDFR_MRI_ACC_L3, data_to_plot$across))
  
  
}
## [1] "visual"

## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$omnibus_span_no_DFR_MRI and data_to_plot$within
## t = 0.72347, df = 166, p-value = 0.4704
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.09616224  0.20572728
## sample estimates:
##        cor 
## 0.05606383 
## 
## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$omnibus_span_no_DFR_MRI and data_to_plot$across
## t = 0.077256, df = 166, p-value = 0.9385
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1455458  0.1572631
## sample estimates:
##         cor 
## 0.005996103

## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$BPRS_TOT and data_to_plot$within
## t = -1.2377, df = 165, p-value = 0.2176
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.24421648  0.05678066
## sample estimates:
##         cor 
## -0.09590996 
## 
## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$BPRS_TOT and data_to_plot$across
## t = -1.2493, df = 165, p-value = 0.2133
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.24506491  0.05588109
## sample estimates:
##         cor 
## -0.09680401

## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$XDFR_MRI_ACC_L3 and data_to_plot$within
## t = 2.2592, df = 166, p-value = 0.02517
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.02187271 0.31586054
## sample estimates:
##       cor 
## 0.1727105 
## 
## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$XDFR_MRI_ACC_L3 and data_to_plot$across
## t = 1.6242, df = 166, p-value = 0.1062
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.02684343  0.27134588
## sample estimates:
##       cor 
## 0.1250747 
## 
## [1] "FPCN"

## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$omnibus_span_no_DFR_MRI and data_to_plot$within
## t = 2.5448, df = 166, p-value = 0.01184
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.04364479 0.33534507
## sample estimates:
##       cor 
## 0.1937741 
## 
## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$omnibus_span_no_DFR_MRI and data_to_plot$across
## t = 0.57111, df = 166, p-value = 0.5687
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1078495  0.1943898
## sample estimates:
##        cor 
## 0.04428339

## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$BPRS_TOT and data_to_plot$within
## t = -1.3264, df = 165, p-value = 0.1866
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.25066394  0.04993225
## sample estimates:
##        cor 
## -0.1027102 
## 
## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$BPRS_TOT and data_to_plot$across
## t = -1.7045, df = 165, p-value = 0.09017
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.27785354  0.02073744
## sample estimates:
##        cor 
## -0.1315404

## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$XDFR_MRI_ACC_L3 and data_to_plot$within
## t = 1.0952, df = 166, p-value = 0.275
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.06757768  0.23311896
## sample estimates:
##        cor 
## 0.08469874 
## 
## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$XDFR_MRI_ACC_L3 and data_to_plot$across
## t = 1.1392, df = 166, p-value = 0.2563
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.06419362  0.23633052
## sample estimates:
##        cor 
## 0.08807219 
## 
## [1] "DMN"

## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$omnibus_span_no_DFR_MRI and data_to_plot$within
## t = 1.4721, df = 166, p-value = 0.1429
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.0385545  0.2604512
## sample estimates:
##      cor 
## 0.113518 
## 
## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$omnibus_span_no_DFR_MRI and data_to_plot$across
## t = 0.083877, df = 166, p-value = 0.9333
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1450427  0.1577643
## sample estimates:
##         cor 
## 0.006510009

## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$BPRS_TOT and data_to_plot$within
## t = 0.32537, df = 165, p-value = 0.7453
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1270299  0.1765070
## sample estimates:
##        cor 
## 0.02532216 
## 
## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$BPRS_TOT and data_to_plot$across
## t = -0.53845, df = 165, p-value = 0.591
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1925209  0.1106858
## sample estimates:
##         cor 
## -0.04188179

## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$XDFR_MRI_ACC_L3 and data_to_plot$within
## t = 2.1863, df = 166, p-value = 0.03019
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.0163018 0.3108348
## sample estimates:
##       cor 
## 0.1672987 
## 
## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$XDFR_MRI_ACC_L3 and data_to_plot$across
## t = 2.3111, df = 166, p-value = 0.02206
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.02583945 0.31942908
## sample estimates:
##       cor 
## 0.1765585 
## 
## [1] "DAN"

## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$omnibus_span_no_DFR_MRI and data_to_plot$within
## t = 2.7707, df = 166, p-value = 0.006232
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.06076595 0.35049405
## sample estimates:
##       cor 
## 0.2102414 
## 
## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$omnibus_span_no_DFR_MRI and data_to_plot$across
## t = 0.51, df = 166, p-value = 0.6107
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1125307  0.1898260
## sample estimates:
##        cor 
## 0.03955304

## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$BPRS_TOT and data_to_plot$within
## t = -1.9661, df = 165, p-value = 0.05097
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.2963526368  0.0005786435
## sample estimates:
##        cor 
## -0.1512982 
## 
## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$BPRS_TOT and data_to_plot$across
## t = -2.1547, df = 165, p-value = 0.03264
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.30951640 -0.01391464
## sample estimates:
##        cor 
## -0.1654287

## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$XDFR_MRI_ACC_L3 and data_to_plot$within
## t = 3.3413, df = 166, p-value = 0.00103
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.1035562 0.3877038
## sample estimates:
##     cor 
## 0.25103 
## 
## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$XDFR_MRI_ACC_L3 and data_to_plot$across
## t = 2.4909, df = 166, p-value = 0.01373
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.03954032 0.33169084
## sample estimates:
##       cor 
## 0.1898137 
## 
## [1] "VAN"

## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$omnibus_span_no_DFR_MRI and data_to_plot$within
## t = 2.4846, df = 166, p-value = 0.01396
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.03906592 0.33126791
## sample estimates:
##       cor 
## 0.1893557 
## 
## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$omnibus_span_no_DFR_MRI and data_to_plot$across
## t = 0.95383, df = 166, p-value = 0.3416
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.07845706  0.22274954
## sample estimates:
##        cor 
## 0.07382977

## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$BPRS_TOT and data_to_plot$within
## t = -1.6117, df = 165, p-value = 0.1089
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.2712288  0.0278980
## sample estimates:
##       cor 
## -0.124493 
## 
## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$BPRS_TOT and data_to_plot$across
## t = -1.6854, df = 165, p-value = 0.09379
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.27649686  0.02220636
## sample estimates:
##       cor 
## -0.130096

## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$XDFR_MRI_ACC_L3 and data_to_plot$within
## t = 0.44308, df = 166, p-value = 0.6583
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1176528  0.1848173
## sample estimates:
##        cor 
## 0.03436926 
## 
## 
##  Pearson's product-moment correlation
## 
## data:  data_to_plot$XDFR_MRI_ACC_L3 and data_to_plot$across
## t = 0.4127, df = 166, p-value = 0.6804
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1199763  0.1825400
## sample estimates:
##       cor 
## 0.0320151

Spatial ISC

This analysis looks at the inter-subject correlation in two different ROIs: a bilateral fusiform ROI from the AAL atlas, and a mask of all regions that showed high load > low load activation during the delay period of the DFR task.

In order to get this data, we extracted the model-free BOLD activity and applied minimal pre-processing using SPM8 (removing cosine, filtering, detrend and meaning the value across voxels). From there, we separated the data into trials. Because the data was jittered, decided that the onset of a trial should be considered the TR that contains the onset of the trial. Once we had the individual trials separated, we averaged over high and low load trials separately. Correlations were taken across all common voxels in the given mask for each pair of subjects for the high load trials, which is the data that we are showing below.

corr_temp <- read.mat("data/ISC_corr.mat")
## Warning in read.mat("data/ISC_corr.mat"): Function class type read as NULL:
suj_corr_fusiform <- corr_temp[["suj_corr"]]
corr_temp <- read.mat("data/ISC_corr_DFR_delay.mat")
## Warning in read.mat("data/ISC_corr_DFR_delay.mat"): Function class type read as
## NULL:
suj_corr_DFR <- corr_temp[["suj_corr"]]

suj_corr_fusiform[is.nan(suj_corr_fusiform)] <- NA
suj_corr_DFR[is.nan(suj_corr_DFR)] <- NA
span_order <- order(constructs_fMRI$omnibus_span_no_DFR_MRI)

fusiform_ISC_ordered <- suj_corr_fusiform[span_order,span_order,]
DFR_ISC_ordered <- suj_corr_DFR[span_order,span_order,]

# select out only subjects who were included in group analyses 

fusiform_ISC_ordered_group <- fusiform_ISC_ordered[c(1:56,58:113,115:170),c(1:56,58:113,115:170),]
DFR_ISC_ordered_group <- DFR_ISC_ordered[c(1:56,58:113,115:170),c(1:56,58:113,115:170),]

# remove NaNs
fusiform_ISC_ordered_group[is.nan(fusiform_ISC_ordered_group)] <- NA
DFR_ISC_ordered_group[is.nan(DFR_ISC_ordered_group)] <- NA
avg_ISC_fusiform <- avg_ISC(suj_corr_fusiform)
avg_ISC_DFR <- avg_ISC(suj_corr_DFR)

overall_avg_ISC_fusiform <- rowMeans(avg_ISC_fusiform)
overall_avg_ISC_DFR <- rowMeans(avg_ISC_DFR)

Fusiform

First looking at the fusiform mask allows us to get a sense as to what the visual cortex is doing. Seeing results here might reflect perceptual representation of the stimuli, and if we see correlations during delay, might suggest that subjects are maintaining the percept of the faces in a similar way.

graph_fusiform <- list()

for (TR in seq.int(1,14)){
  data <- data.frame(fusiform_ISC_ordered_group[,,TR])
  rownames(data) <- c(1:168)
  colnames(data) <- c(1:168)
  data %>%
    
    # Data wrangling
    as_tibble() %>%
    rowid_to_column(var="X") %>%
    gather(key="Y", value="Z", -1) %>% 
    
    # Change Y to numeric
    mutate(Y=as.numeric(gsub("V","",Y))) -> mutated_data
  # 
  ggplot(data=mutated_data,aes(X, Y, fill= Z)) +
    geom_tile() +
    scale_y_continuous(breaks = c(0,50,100,150),labels=c(0,50,100,150))+
    geom_hline(yintercept=56,color="black")+
    geom_hline(yintercept=113,color="black")+
    geom_vline(xintercept=56,color="black")+
    geom_vline(xintercept=113,color="black")+
    scale_fill_gradient2()+
    theme(aspect=1)+
    ggtitle(paste("TR:",TR))-> graph_fusiform[[TR]]
  
  if (TR > 1){
    graph_fusiform[[TR]][["theme"]][["legend.position"]] = "none"
  }
  
}

First, we want to just look at the correlations between subjects over time. We can see that peak intersubject correlations happen around TR 4-6, drop and then get higher around TR 8-9. These TRs correspond to the encoding period and the beginning of the probe period - when there are actually stimuli on the screen.

The lines here represent divisions between groups - subjects are sorted by span, starting with low span at the bottom left corner and moving up and to the right. There doesn’t really seem to be any pattern within or across groups.

(graph_fusiform[[1]]+graph_fusiform[[2]] + graph_fusiform[[3]]) +
  plot_layout(guides = "collect")+
  plot_annotation(title="Fusiform Mask")

(graph_fusiform[[4]] + graph_fusiform[[5]] + graph_fusiform[[6]])

(graph_fusiform[[7]] + graph_fusiform[[8]] + graph_fusiform[[9]])

(graph_fusiform[[10]] + graph_fusiform[[11]] + graph_fusiform[[12]])

(graph_fusiform[[13]] + graph_fusiform[[14]])

z_trans_fusiform <-  atanh(fusiform_ISC_ordered_group)
z_trans_fusiform[z_trans_fusiform==Inf] <- NA
z_trans_corr <- z_trans_fusiform

t_test_res_fusiform = data.frame(matrix(nrow=14,ncol=2)) 
colnames(t_test_res_fusiform) <- c("t value","p value")
cols <- c("low_within","low_across","med_within","med_across","high_within","high_across")

group_means_fusiform <- data.frame(matrix(nrow=14,ncol=6))
colnames(group_means_fusiform) <- cols

group_se_fusiform <- data.frame(matrix(nrow=14,ncol=6))
colnames(group_se_fusiform) <- cols

avg_over_groups_fusiform <- list(mean=data.frame(within = matrix(nrow=14,ncol=1),across = matrix(nrow=14,ncol=1)),
                                 se=data.frame(within = matrix(nrow=14,ncol=1),across = matrix(nrow=14,ncol=1)))

split_data_fusiform <- list()

for (TR in seq.int(1:14)){
  
  # define dataframes 
  comps <- data.frame(within = matrix(nrow=168,ncol=1),across = matrix(nrow=168,ncol=1))
  
  
  
  split_by_groups <- data.frame(matrix(nrow=56,ncol=6))
  colnames(split_by_groups) <- cols
  
  # loop over all subjects and make comparisons
  for (suj in seq.int(1,168)){
    if (suj < 57){
      comps$within[suj] <- mean(z_trans_corr[1:56,suj,TR],na.rm=TRUE)
      comps$across[suj] <- mean(z_trans_corr[57:168,suj,TR],na.rm=TRUE)
    }else if (suj > 56 & suj < 113){ 
      comps$within[suj] <- mean(z_trans_corr[57:112,suj,TR],na.rm=TRUE)
      comps$across[suj] <- mean(z_trans_corr[c(1:56,113:168),suj,TR],na.rm=TRUE)
    }else if (suj > 112){ 
      comps$within[suj] <- mean(z_trans_corr[113:168,suj,TR],na.rm=TRUE)
      comps$across[suj] <- mean(z_trans_corr[1:112,suj,TR],na.rm=TRUE)}
    
  }
  
  # average over groups 
  avg_over_groups_fusiform[["mean"]]$within[TR] <- mean(comps$within)
  avg_over_groups_fusiform[["mean"]]$across[TR] <- mean(comps$across)
  avg_over_groups_fusiform[["se"]]$within[TR] <- se(comps$within)
  avg_over_groups_fusiform[["se"]]$across[TR] <- se(comps$across)
  
  avg_over_groups_fusiform[["mean"]]$difference[TR] <- avg_over_groups_fusiform[["mean"]]$within[TR] - avg_over_groups_fusiform[["mean"]]$across[TR]
  avg_over_groups_fusiform[["se"]]$difference[TR] <- se(comps$within - comps$across)
  
  # split by groups 
  split_by_groups$low_across <- comps$across[1:56]
  split_by_groups$low_within <- comps$within[1:56]
  
  split_by_groups$med_across <- comps$across[57:112]
  split_by_groups$med_within <- comps$within[57:112]
  
  split_by_groups$high_across <- comps$across[113:168]
  split_by_groups$high_within <- comps$within[113:168]
  
  group_means_fusiform[TR,] <- colMeans(split_by_groups)
  for (group in seq.int(1,6)){
    group_se_fusiform[TR,group] <- se(split_by_groups[,group])
  }
  temp2 <- t.test(comps$within,comps$across,paired=TRUE,var.equal = FALSE)
  t_test_res_fusiform[TR,] <- c(temp2$statistic,temp2$p.value)
 
  split_data_fusiform[[TR]] <- split_by_groups 
}

All time points are significantly different.

print(t_test_res_fusiform)
##     t value      p value
## 1  7.517220 3.250766e-12
## 2  7.849980 4.768215e-13
## 3  7.848735 4.802915e-13
## 4  8.747743 2.273005e-15
## 5  7.447015 4.850177e-12
## 6  7.812660 5.924367e-13
## 7  8.619990 4.929059e-15
## 8  7.227409 1.676167e-11
## 9  7.833776 5.239835e-13
## 10 9.036165 3.903853e-16
## 11 8.283708 3.705993e-14
## 12 7.685563 1.236713e-12
## 13 8.077969 1.253792e-13
## 14 7.637561 1.630710e-12

Next, we want to take a quick sanity check and see how just averaging across all subjects, but looking within and across groups. We see similar time courses to what we were seeing with the full matrices. It is interesting to note that within subject correlations are higher than across subject ones.

plot_temp <- melt(cbind(avg_over_groups_fusiform[["mean"]],time=c(1:14)),id.vars="time")[1:28,]
se_plot_temp <- melt(cbind(avg_over_groups_fusiform[["se"]],time=c(1:14)),id.vars="time")[1:28,]
plot_temp <- merge(plot_temp,se_plot_temp,by=c("time","variable"))
colnames(plot_temp) <- c("time","variable","mean","se")

ggplot(data=plot_temp)+
  geom_line(aes(x=time,y=mean,color=variable))+
  geom_ribbon(aes(x=time,ymin=mean-se,ymax=mean+se,fill=variable),alpha=0.2)+
  ggtitle("Fusiform ISC - regardless of WM group")+
  theme_classic()

The last analysis didn’t take into account the span of the subjects - now we’ll look at them.

Seems as though low capacity subjects show less within group correlation than the other two groups during encoding, but no real differences otherwise.

group_means_fusiform$TR <- c(1:14) 
group_se_fusiform$TR <- c(1:14) 

melted_group <-  melt(group_means_fusiform, id.vars="TR",value.name="mean")
melted_se <- melt(group_se_fusiform,id.vars="TR",value.name="se")

merge(melted_group,melted_se) %>% 
  ggplot()+
  geom_rect(data=rects,aes(xmin=xstart, xmax=xend, ymin = -Inf, ymax=Inf), fill="grey", alpha =0.4,show.legend = FALSE)+
  geom_line(aes(x=TR,y=mean,color=variable))+
  geom_ribbon(aes(x=TR,ymin=mean-se,ymax=mean+se,fill=variable),alpha=0.2)+
  scale_x_continuous(breaks = c(1:14),labels=c(1:14))+
  ggtitle("Fusiform ISC")+
  theme_classic()-> graph

graph

fusiform_split_melt_TR5 <- melt(split_data_fusiform[[5]])
## No id variables; using all as measure variables
fusiform_split_melt_TR5$variable <- as.character(fusiform_split_melt_TR5$variable)

for (row in seq.int(1,nrow(fusiform_split_melt_TR5))){
  split <- strsplit(fusiform_split_melt_TR5$variable[row], split="_")[[1]]
  fusiform_split_melt_TR5$WMC[row] <- split[1]
  fusiform_split_melt_TR5$comp[row] <- split[2]
  
}
colnames(fusiform_split_melt_TR5)[1:2] <- c("unsplit", "ISC")
fusiform_split_melt_TR5$WMC <- factor(fusiform_split_melt_TR5$WMC, levels = c("low","med", "high"))
fusiform_split_melt_TR5$comp <- factor(fusiform_split_melt_TR5$comp, levels = c("within", "across"))


aov.res_TR5 <- aov(ISC ~ WMC*comp, data = fusiform_split_melt_TR5)

summary(aov.res_TR5)
##              Df Sum Sq Mean Sq F value   Pr(>F)    
## WMC           2  0.129  0.0645   2.241    0.108    
## comp          1  0.621  0.6212  21.574 4.92e-06 ***
## WMC:comp      2  0.039  0.0193   0.670    0.512    
## Residuals   330  9.502  0.0288                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
fusiform_split_melt_TR12 <- melt(split_data_fusiform[[12]])
## No id variables; using all as measure variables
fusiform_split_melt_TR12$variable <- as.character(fusiform_split_melt_TR12$variable)

for (row in seq.int(1,nrow(fusiform_split_melt_TR12))){
  split <- strsplit(fusiform_split_melt_TR12$variable[row], split="_")[[1]]
  fusiform_split_melt_TR12$WMC[row] <- split[1]
  fusiform_split_melt_TR12$comp[row] <- split[2]
  
}
colnames(fusiform_split_melt_TR12)[1:2] <- c("unsplit", "ISC")
fusiform_split_melt_TR12$WMC <- factor(fusiform_split_melt_TR12$WMC, levels = c("low","med", "high"))
fusiform_split_melt_TR12$comp <- factor(fusiform_split_melt_TR12$comp, levels = c("within", "across"))


aov.res_TR12 <- aov(ISC ~ WMC*comp, data = fusiform_split_melt_TR12)

summary(aov.res_TR12)
##              Df Sum Sq Mean Sq F value   Pr(>F)    
## WMC           2  0.117  0.0584   2.892   0.0569 .  
## comp          1  0.740  0.7397  36.648 3.85e-09 ***
## WMC:comp      2  0.075  0.0376   1.865   0.1565    
## Residuals   330  6.661  0.0202                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

If we average over time, there is a super strong correlation between accuracy and average ISC in the fusiform, but we don’t see that for any other relationship.

data_to_plot <- merge(constructs_fMRI,p200_clinical_zscores, by="PTID")
data_to_plot <- merge(data_to_plot,p200_data[,c(1,7)])

data_to_plot <- cbind(data_to_plot,overall_avg_ISC_fusiform,overall_avg_ISC_DFR)

cor.test(overall_avg_ISC_fusiform,data_to_plot$omnibus_span_no_DFR_MRI)
## 
##  Pearson's product-moment correlation
## 
## data:  overall_avg_ISC_fusiform and data_to_plot$omnibus_span_no_DFR_MRI
## t = 0.76879, df = 168, p-value = 0.4431
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.09212565  0.20787134
## sample estimates:
##        cor 
## 0.05920962
cor.test(overall_avg_ISC_fusiform,data_to_plot$XDFR_MRI_ACC_L3)
## 
##  Pearson's product-moment correlation
## 
## data:  overall_avg_ISC_fusiform and data_to_plot$XDFR_MRI_ACC_L3
## t = 4.2985, df = 168, p-value = 2.906e-05
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.1724315 0.4442430
## sample estimates:
##       cor 
## 0.3147762
cor.test(overall_avg_ISC_fusiform,data_to_plot$WHO_ST_S32)
## 
##  Pearson's product-moment correlation
## 
## data:  overall_avg_ISC_fusiform and data_to_plot$WHO_ST_S32
## t = -2.3527, df = 168, p-value = 0.0198
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.32049393 -0.02885634
## sample estimates:
##        cor 
## -0.1785949
cor.test(overall_avg_ISC_fusiform,data_to_plot$BPRS_TOT)
## 
##  Pearson's product-moment correlation
## 
## data:  overall_avg_ISC_fusiform and data_to_plot$BPRS_TOT
## t = -2.2068, df = 168, p-value = 0.02868
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.3105153 -0.0177806
## sample estimates:
##        cor 
## -0.1678457
ggplot(data=data_to_plot,aes(x=overall_avg_ISC_fusiform,omnibus_span_no_DFR_MRI))+
  geom_point()+
  stat_smooth(method="lm")+
  ggtitle("Avg ISC fusiform vs omnibus span")
## `geom_smooth()` using formula 'y ~ x'

ggplot(data=data_to_plot,aes(x=overall_avg_ISC_fusiform,XDFR_MRI_ACC_L3))+
  geom_point()+
  stat_smooth(method="lm")+
  ggtitle("Avg ISC fusiform vs L3 DFR Acc")
## `geom_smooth()` using formula 'y ~ x'

ggplot(data=data_to_plot,aes(x=overall_avg_ISC_fusiform,WHO_ST_S32))+
  geom_point()+
  stat_smooth(method="lm")+
  ggtitle("Avg ISC fusiform vs WHODAS")
## `geom_smooth()` using formula 'y ~ x'

ggplot(data=data_to_plot,aes(x=overall_avg_ISC_fusiform,BPRS_TOT))+
  geom_point()+
  stat_smooth(method="lm")+
  ggtitle("Avg ISC fusiform vs BPRS Total")
## `geom_smooth()` using formula 'y ~ x'

If we break this down by TR, we see signficant linear relationships between ISC and WHODAS at TR 1, 4, 5, 6, and 9, BPRS at TRs 5-7 and accuracy at TRs 2, 3, 4, 6, 7, 8, 9, 11, and 12.

Overall, it seems that ISC during probe (and a little bit during encoding) is relate to performance and span.

corr_ISC(avg_ISC_fusiform,data_to_plot[,c(1,7)])
## [1] "TR: 1; measure: omnibus_span_no_DFR_MRI"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 0.44174, df = 168, p-value = 0.6592
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1170534  0.1836337
## sample estimates:
##       cor 
## 0.0340609 
## 
## [1] "TR: 2; measure: omnibus_span_no_DFR_MRI"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 0.49604, df = 168, p-value = 0.6205
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1129219  0.1876764
## sample estimates:
##        cor 
## 0.03824238 
## 
## [1] "TR: 3; measure: omnibus_span_no_DFR_MRI"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -0.23987, df = 168, p-value = 0.8107
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1685478  0.1323800
## sample estimates:
##         cor 
## -0.01850291 
## 
## [1] "TR: 4; measure: omnibus_span_no_DFR_MRI"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 0.286, df = 168, p-value = 0.7752
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1288822  0.1720032
## sample estimates:
##        cor 
## 0.02206003 
## 
## [1] "TR: 5; measure: omnibus_span_no_DFR_MRI"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 1.2198, df = 168, p-value = 0.2242
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.05763109  0.24081406
## sample estimates:
##        cor 
## 0.09369591 
## 
## [1] "TR: 6; measure: omnibus_span_no_DFR_MRI"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 0.82895, df = 168, p-value = 0.4083
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.0875305  0.2122994
## sample estimates:
##        cor 
## 0.06382461 
## 
## [1] "TR: 7; measure: omnibus_span_no_DFR_MRI"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 0.13219, df = 168, p-value = 0.895
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1405320  0.1604659
## sample estimates:
##        cor 
## 0.01019794 
## 
## [1] "TR: 8; measure: omnibus_span_no_DFR_MRI"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 1.2483, df = 168, p-value = 0.2137
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.05545089  0.24287333
## sample estimates:
##        cor 
## 0.09586345 
## 
## [1] "TR: 9; measure: omnibus_span_no_DFR_MRI"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 0.53512, df = 168, p-value = 0.5933
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1099465  0.1905814
## sample estimates:
##       cor 
## 0.0412504 
## 
## [1] "TR: 10; measure: omnibus_span_no_DFR_MRI"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 0.1486, df = 168, p-value = 0.882
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1392904  0.1616994
## sample estimates:
##        cor 
## 0.01146417 
## 
## [1] "TR: 11; measure: omnibus_span_no_DFR_MRI"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 0.1367, df = 168, p-value = 0.8914
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1401905  0.1608053
## sample estimates:
##        cor 
## 0.01054626 
## 
## [1] "TR: 12; measure: omnibus_span_no_DFR_MRI"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 0.19812, df = 168, p-value = 0.8432
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1355426  0.1654172
## sample estimates:
##        cor 
## 0.01528346 
## 
## [1] "TR: 13; measure: omnibus_span_no_DFR_MRI"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 0.31641, df = 168, p-value = 0.7521
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1265749  0.1742784
## sample estimates:
##        cor 
## 0.02440431
corr_ISC(avg_ISC_fusiform,data_to_plot[,c(1,9)])
## [1] "TR: 1; measure: WHO_ST_S32"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -1.9936, df = 168, p-value = 0.04781
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.295771383 -0.001546073
## sample estimates:
##        cor 
## -0.1520249
## `geom_smooth()` using formula 'y ~ x'

## [1] "TR: 2; measure: WHO_ST_S32"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -1.0538, df = 168, p-value = 0.2935
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.22875678  0.07033958
## sample estimates:
##         cor 
## -0.08103257 
## 
## [1] "TR: 3; measure: WHO_ST_S32"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -0.53625, df = 168, p-value = 0.5925
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1906650  0.1098608
## sample estimates:
##         cor 
## -0.04133701 
## 
## [1] "TR: 4; measure: WHO_ST_S32"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -2.1542, df = 168, p-value = 0.03265
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.3068922 -0.0137768
## sample estimates:
##        cor 
## -0.1639511
## `geom_smooth()` using formula 'y ~ x'

## [1] "TR: 5; measure: WHO_ST_S32"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -2.2474, df = 168, p-value = 0.02592
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.31329888 -0.02086301
## sample estimates:
##        cor 
## -0.1708408
## `geom_smooth()` using formula 'y ~ x'

## [1] "TR: 6; measure: WHO_ST_S32"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -2.0526, df = 168, p-value = 0.04166
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.299865721 -0.006038845
## sample estimates:
##        cor 
## -0.1564109
## `geom_smooth()` using formula 'y ~ x'

## [1] "TR: 7; measure: WHO_ST_S32"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -1.5913, df = 168, p-value = 0.1134
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.26746843  0.02918964
## sample estimates:
##      cor 
## -0.12186 
## 
## [1] "TR: 8; measure: WHO_ST_S32"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -1.8333, df = 168, p-value = 0.06853
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.28456187  0.01069379
## sample estimates:
##        cor 
## -0.1400459 
## 
## [1] "TR: 9; measure: WHO_ST_S32"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -2.0102, df = 168, p-value = 0.04601
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.296920425 -0.002805735
## sample estimates:
##        cor 
## -0.1532553
## `geom_smooth()` using formula 'y ~ x'

## [1] "TR: 10; measure: WHO_ST_S32"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -0.4966, df = 168, p-value = 0.6201
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1877181  0.1128791
## sample estimates:
##         cor 
## -0.03828562 
## 
## [1] "TR: 11; measure: WHO_ST_S32"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 0.086896, df = 168, p-value = 0.9309
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1439555  0.1570598
## sample estimates:
##         cor 
## 0.006704011 
## 
## [1] "TR: 12; measure: WHO_ST_S32"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -0.32454, df = 168, p-value = 0.7459
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1748861  0.1259581
## sample estimates:
##         cor 
## -0.02503074 
## 
## [1] "TR: 13; measure: WHO_ST_S32"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -1.199, df = 168, p-value = 0.2322
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.23930645  0.05922544
## sample estimates:
##         cor 
## -0.09210991
corr_ISC(avg_ISC_fusiform,data_to_plot[,c(1,15)])
## [1] "TR: 1; measure: BPRS_TOT"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -1.1147, df = 168, p-value = 0.2666
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.2331916  0.0656765
## sample estimates:
##         cor 
## -0.08568477 
## 
## [1] "TR: 2; measure: BPRS_TOT"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -1.7794, df = 168, p-value = 0.07699
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.28077245  0.01481162
## sample estimates:
##        cor 
## -0.1360058 
## 
## [1] "TR: 3; measure: BPRS_TOT"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -0.50011, df = 168, p-value = 0.6177
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1879787  0.1126125
## sample estimates:
##         cor 
## -0.03855528 
## 
## [1] "TR: 4; measure: BPRS_TOT"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -1.8551, df = 168, p-value = 0.06534
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.286090791  0.009029535
## sample estimates:
##        cor 
## -0.1416773 
## 
## [1] "TR: 5; measure: BPRS_TOT"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -2.3886, df = 168, p-value = 0.01802
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.32294084 -0.03158326
## sample estimates:
##       cor 
## -0.181236
## `geom_smooth()` using formula 'y ~ x'

## [1] "TR: 6; measure: BPRS_TOT"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -2.9742, df = 168, p-value = 0.00337
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.36198260 -0.07568742
## sample estimates:
##        cor 
## -0.2236538
## `geom_smooth()` using formula 'y ~ x'

## [1] "TR: 7; measure: BPRS_TOT"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -2.1611, df = 168, p-value = 0.03211
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.30736468 -0.01429843
## sample estimates:
##        cor 
## -0.1644587
## `geom_smooth()` using formula 'y ~ x'

## [1] "TR: 8; measure: BPRS_TOT"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -1.1848, df = 168, p-value = 0.2378
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.23827715  0.06031308
## sample estimates:
##         cor 
## -0.09102752 
## 
## [1] "TR: 9; measure: BPRS_TOT"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -1.8353, df = 168, p-value = 0.06823
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.28470602  0.01053696
## sample estimates:
##        cor 
## -0.1401996 
## 
## [1] "TR: 10; measure: BPRS_TOT"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -0.59404, df = 168, p-value = 0.5533
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1949540  0.1054578
## sample estimates:
##        cor 
## -0.0457832 
## 
## [1] "TR: 11; measure: BPRS_TOT"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 0.60416, df = 168, p-value = 0.5465
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1046862  0.1957044
## sample estimates:
##       cor 
## 0.0465617 
## 
## [1] "TR: 12; measure: BPRS_TOT"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -0.5117, df = 168, p-value = 0.6095
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1888408  0.1117299
## sample estimates:
##         cor 
## -0.03944776 
## 
## [1] "TR: 13; measure: BPRS_TOT"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -0.92908, df = 168, p-value = 0.3542
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.21964711  0.07987729
## sample estimates:
##         cor 
## -0.07149654
corr_ISC(avg_ISC_fusiform,data_to_plot[,c(1,21)])
## [1] "TR: 1; measure: XDFR_MRI_ACC_L3"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 1.8144, df = 168, p-value = 0.0714
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.01213472  0.28323691
## sample estimates:
##       cor 
## 0.1386327 
## 
## [1] "TR: 2; measure: XDFR_MRI_ACC_L3"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 3.0027, df = 168, p-value = 0.003084
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.07781827 0.36384377
## sample estimates:
##       cor 
## 0.2256891
## `geom_smooth()` using formula 'y ~ x'

## [1] "TR: 3; measure: XDFR_MRI_ACC_L3"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 2.9681, df = 168, p-value = 0.003435
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.07522651 0.36157972
## sample estimates:
##       cor 
## 0.2232134
## `geom_smooth()` using formula 'y ~ x'

## [1] "TR: 4; measure: XDFR_MRI_ACC_L3"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 2.0573, df = 168, p-value = 0.04121
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.006395674 0.300190442
## sample estimates:
##      cor 
## 0.156759
## `geom_smooth()` using formula 'y ~ x'

## [1] "TR: 5; measure: XDFR_MRI_ACC_L3"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 1.9737, df = 168, p-value = 0.05005
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  2.610606e-05 2.943838e-01
## sample estimates:
##       cor 
## 0.1505398 
## 
## [1] "TR: 6; measure: XDFR_MRI_ACC_L3"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 2.1145, df = 168, p-value = 0.03595
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.01075597 0.30415290
## sample estimates:
##       cor 
## 0.1610096
## `geom_smooth()` using formula 'y ~ x'

## [1] "TR: 7; measure: XDFR_MRI_ACC_L3"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 4.2424, df = 168, p-value = 3.646e-05
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.1684429 0.4409397
## sample estimates:
##       cor 
## 0.3110705
## `geom_smooth()` using formula 'y ~ x'

## [1] "TR: 8; measure: XDFR_MRI_ACC_L3"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 3.7693, df = 168, p-value = 0.0002263
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.1343758 0.4124224
## sample estimates:
##       cor 
## 0.2792422
## `geom_smooth()` using formula 'y ~ x'

## [1] "TR: 9; measure: XDFR_MRI_ACC_L3"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 3.0003, df = 168, p-value = 0.003108
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.07763497 0.36368376
## sample estimates:
##       cor 
## 0.2255141
## `geom_smooth()` using formula 'y ~ x'

## [1] "TR: 10; measure: XDFR_MRI_ACC_L3"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 1.8272, df = 168, p-value = 0.06944
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.01115406  0.28413877
## sample estimates:
##       cor 
## 0.1395946 
## 
## [1] "TR: 11; measure: XDFR_MRI_ACC_L3"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 2.8815, df = 168, p-value = 0.004474
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.06874757 0.35590520
## sample estimates:
##       cor 
## 0.2170162
## `geom_smooth()` using formula 'y ~ x'

## [1] "TR: 12; measure: XDFR_MRI_ACC_L3"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 3.3772, df = 168, p-value = 0.00091
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.1056322 0.3879298
## sample estimates:
##       cor 
## 0.2521376
## `geom_smooth()` using formula 'y ~ x'

## [1] "TR: 13; measure: XDFR_MRI_ACC_L3"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 1.7773, df = 168, p-value = 0.07733
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.01496895  0.28062748
## sample estimates:
##       cor 
## 0.1358514

DFR

The next step is to look at regions that are actually implicated in working memory.

graph_DFR <- list()

for (TR in seq.int(1,14)){
  data <- data.frame(DFR_ISC_ordered_group[,,TR])
  rownames(data) <- c(1:168)
  colnames(data) <- c(1:168)
  data %>%
    
    # Data wrangling
    as_tibble() %>%
    rowid_to_column(var="X") %>%
    gather(key="Y", value="Z", -1) %>% 
    
    # Change Y to numeric
    mutate(Y=as.numeric(gsub("V","",Y))) -> mutated_data
  # 
  ggplot(data=mutated_data,aes(X, Y, fill= Z)) +
    geom_tile() +
    scale_y_continuous(breaks = c(0,50,100,150),labels=c(0,50,100,150))+
    geom_hline(yintercept=56,color="black")+
    geom_hline(yintercept=113,color="black")+
    geom_vline(xintercept=56,color="black")+
    geom_vline(xintercept=113,color="black")+
    scale_fill_gradient2()+
    theme(aspect=1)+
    ggtitle(paste("TR:",TR))-> graph_DFR[[TR]]
  
  if (TR > 1){
    graph_DFR[[TR]][["theme"]][["legend.position"]] = "none"
  }
  
}

These correlations are not as strong as the fusiform mask, but we still do see an increase in correlations around TRs 5-6 (during encoding)

(graph_DFR[[1]]+graph_DFR[[2]] + graph_DFR[[3]]) +
  plot_layout(guides = "collect")+
  plot_annotation(title="DFR Mask")

(graph_DFR[[4]] + graph_DFR[[5]] + graph_DFR[[6]])

(graph_DFR[[7]] + graph_DFR[[8]] + graph_DFR[[9]])

(graph_DFR[[10]] + graph_DFR[[11]] + graph_DFR[[12]])

(graph_DFR[[13]] + graph_DFR[[14]])

z_trans_DFR <-  atanh(DFR_ISC_ordered_group)
z_trans_DFR[z_trans_DFR==Inf] <- NA
z_trans_corr <- z_trans_DFR

t_test_res_DFR = data.frame(matrix(nrow=14,ncol=2)) 
colnames(t_test_res_DFR) <- c("t value","p value")

group_means_DFR <- data.frame(matrix(nrow=14,ncol=6))
colnames(group_means_DFR) <- cols

group_se_DFR <- data.frame(matrix(nrow=14,ncol=6))
colnames(group_se_DFR) <- cols

avg_over_groups_DFR <- list(mean=data.frame(within = matrix(nrow=14,ncol=1),across = matrix(nrow=14,ncol=1)),
                            se=data.frame(within = matrix(nrow=14,ncol=1),across = matrix(nrow=14,ncol=1)))

split_data_DFR <- list()
for (TR in seq.int(1:14)){
  
  # define dataframes 
  comps <- data.frame(within = matrix(nrow=168,ncol=1),across = matrix(nrow=168,ncol=1))
  
  split_by_groups <- data.frame(matrix(nrow=56,ncol=6))
  colnames(split_by_groups) <- cols
  
  # loop over all subjects and make comparisons
  for (suj in seq.int(1,168)){
    if (suj < 57){
      comps$within[suj] <- mean(z_trans_corr[1:56,suj,TR],na.rm=TRUE)
      comps$across[suj] <- mean(z_trans_corr[57:168,suj,TR],na.rm=TRUE)
    }else if (suj > 56 & suj < 113){ 
      comps$within[suj] <- mean(z_trans_corr[57:112,suj,TR],na.rm=TRUE)
      comps$across[suj] <- mean(z_trans_corr[c(1:56,113:168),suj,TR],na.rm=TRUE)
    }else if (suj > 112){ 
      comps$within[suj] <- mean(z_trans_corr[113:168,suj,TR],na.rm=TRUE)
      comps$across[suj] <- mean(z_trans_corr[1:112,suj,TR],na.rm=TRUE)}
    
  }
  
  # average over groups 
  avg_over_groups_DFR[["mean"]]$within[TR] <- mean(comps$within)
  avg_over_groups_DFR[["mean"]]$across[TR] <- mean(comps$across)
  avg_over_groups_DFR[["se"]]$within[TR] <- se(comps$within)
  avg_over_groups_DFR[["se"]]$across[TR] <- se(comps$across)
  
  avg_over_groups_DFR[["mean"]]$difference[TR] <- avg_over_groups_DFR[["mean"]]$within[TR] - avg_over_groups_DFR[["mean"]]$across[TR]
  avg_over_groups_DFR[["se"]]$difference[TR] <- se(comps$within - comps$across)
  
  # split by groups 
  split_by_groups$low_across <- comps$across[1:56]
  split_by_groups$low_within <- comps$within[1:56]
  
  split_by_groups$med_across <- comps$across[57:112]
  split_by_groups$med_within <- comps$within[57:112]
  
  split_by_groups$high_across <- comps$across[113:168]
  split_by_groups$high_within <- comps$within[113:168]
  
  group_means_DFR[TR,] <- colMeans(split_by_groups)
  for (group in seq.int(1,6)){
    group_se_DFR[TR,group] <- se(split_by_groups[,group])
  }
  
  temp2 <- t.test(comps$within,comps$across,paired=TRUE,var.equal = FALSE)
  t_test_res_DFR[TR,] <- c(temp2$statistic,temp2$p.value)
  split_data_DFR[[TR]] <-split_by_groups
}

All time points are significantly different.

print(t_test_res_DFR)
##     t value      p value
## 1  10.62819 1.769375e-20
## 2  10.75847 7.684782e-21
## 3  11.57843 3.906112e-23
## 4  11.14335 6.481272e-22
## 5  12.43721 1.488099e-25
## 6  11.82523 7.901208e-24
## 7  12.68754 2.924909e-26
## 8  11.74914 1.293633e-23
## 9  12.67752 3.121740e-26
## 10 11.88681 5.300672e-24
## 11 11.09377 8.919037e-22
## 12 11.86393 6.148470e-24
## 13 13.22862 8.690418e-28
## 14 11.53691 5.109548e-23

Reflecting that, we’re seeing lower correlations, but a similar effect that within group correlations are higher than across group. However, we’re not seeing as much of a bump in the probe period, and the peak in the encoding is slightly later than in the fusiform region.

plot_temp <- melt(cbind(avg_over_groups_DFR[["mean"]],time=c(1:14)),id.vars="time")[1:28,]
se_plot_temp <- melt(cbind(avg_over_groups_DFR[["se"]],time=c(1:14)),id.vars="time")[1:28,]
plot_temp <- merge(plot_temp,se_plot_temp,by=c("time","variable"))
colnames(plot_temp) <- c("time","variable","mean","se")

ggplot(data=plot_temp)+
  geom_line(aes(x=time,y=mean,color=variable))+
  geom_ribbon(aes(x=time,ymin=mean-se,ymax=mean+se,fill=variable),alpha=0.2)+
  ggtitle("DFR ISC - regardless of WM group")

At the beginning of the probe period, we’re starting to see potential differences across groups - it almost looks as though there is higher within subject correlations in the medium and high capacity subjects vs low capacity subjects during the probe period. Will need to do further stats to see if this is statistically significant.

group_means_DFR$TR <- c(1:14) 
group_se_DFR$TR <- c(1:14) 

melted_group <-  melt(group_means_DFR, id.vars="TR",value.name="mean")
melted_se <- melt(group_se_DFR,id.vars="TR",value.name="se")

merge(melted_group,melted_se) %>% 
  ggplot()+
  geom_rect(data=rects,aes(xmin=xstart, xmax=xend, ymin = -Inf, ymax=Inf), fill="grey", alpha =0.4,show.legend = FALSE)+
  geom_line(aes(x=TR,y=mean,color=variable))+
  geom_ribbon(aes(x=TR,ymin=mean-se,ymax=mean+se,fill=variable),alpha=0.2)+
  scale_x_continuous(breaks = c(1:14),labels=c(1:14))+
  ggtitle("DFR ISC")+
  theme_classic() -> graph

graph

DFR_split_melt_TR9 <- melt(split_data_DFR[[9]])
## No id variables; using all as measure variables
DFR_split_melt_TR9$variable <- as.character(DFR_split_melt_TR9$variable)

for (row in seq.int(1,nrow(DFR_split_melt_TR9))){
  split <- strsplit(DFR_split_melt_TR9$variable[row], split="_")[[1]]
  DFR_split_melt_TR9$WMC[row] <- split[1]
  DFR_split_melt_TR9$comp[row] <- split[2]
  
}
colnames(DFR_split_melt_TR9)[1:2] <- c("unsplit", "ISC")
DFR_split_melt_TR9$WMC <- factor(DFR_split_melt_TR9$WMC, levels = c("low","med", "high"))
DFR_split_melt_TR9$comp <- factor(DFR_split_melt_TR9$comp, levels = c("within", "across"))


aov.res_TR9 <- aov(ISC ~ WMC*comp, data = DFR_split_melt_TR9)
summary(aov.res_TR9)
##              Df Sum Sq Mean Sq F value Pr(>F)    
## WMC           2  0.088  0.0438   2.247  0.107    
## comp          1  2.481  2.4810 127.183 <2e-16 ***
## WMC:comp      2  0.059  0.0293   1.502  0.224    
## Residuals   330  6.437  0.0195                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
DFR_split_melt_TR13 <- melt(split_data_DFR[[13]])
## No id variables; using all as measure variables
DFR_split_melt_TR13$variable <- as.character(DFR_split_melt_TR13$variable)

for (row in seq.int(1,nrow(DFR_split_melt_TR13))){
  split <- strsplit(DFR_split_melt_TR13$variable[row], split="_")[[1]]
  DFR_split_melt_TR13$WMC[row] <- split[1]
  DFR_split_melt_TR13$comp[row] <- split[2]
  
}
colnames(DFR_split_melt_TR13)[1:2] <- c("unsplit", "ISC")
DFR_split_melt_TR13$WMC <- factor(DFR_split_melt_TR13$WMC, levels = c("low","med", "high"))
DFR_split_melt_TR13$comp <- factor(DFR_split_melt_TR13$comp, levels = c("within", "across"))


aov.res_TR13 <- aov(ISC ~ WMC*comp, data = DFR_split_melt_TR13)

summary(aov.res_TR13)
##              Df Sum Sq Mean Sq F value Pr(>F)    
## WMC           2  0.083  0.0416   2.189  0.114    
## comp          1  2.546  2.5465 134.142 <2e-16 ***
## WMC:comp      2  0.088  0.0438   2.307  0.101    
## Residuals   330  6.265  0.0190                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

If we take the same plan of attack as before and look at the correlation between ISC averaged over the whole time course and cognitive/clinical measures, we’re seeing the same thing - nothing except a very strong correlation with performance.

cor.test(overall_avg_ISC_DFR,data_to_plot$omnibus_span_no_DFR_MRI)
## 
##  Pearson's product-moment correlation
## 
## data:  overall_avg_ISC_DFR and data_to_plot$omnibus_span_no_DFR_MRI
## t = 1.0317, df = 168, p-value = 0.3037
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.07202695  0.22714894
## sample estimates:
##        cor 
## 0.07934751
cor.test(overall_avg_ISC_DFR,data_to_plot$XDFR_MRI_ACC_L3)
## 
##  Pearson's product-moment correlation
## 
## data:  overall_avg_ISC_DFR and data_to_plot$XDFR_MRI_ACC_L3
## t = 5.5685, df = 168, p-value = 1e-07
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.2596474 0.5146711
## sample estimates:
##       cor 
## 0.3947352
cor.test(overall_avg_ISC_DFR,data_to_plot$WHO_ST_S32)
## 
##  Pearson's product-moment correlation
## 
## data:  overall_avg_ISC_DFR and data_to_plot$WHO_ST_S32
## t = -0.77335, df = 168, p-value = 0.4404
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.20820677  0.09177802
## sample estimates:
##         cor 
## -0.05955898
cor.test(overall_avg_ISC_DFR,data_to_plot$BPRS_TOT)
## 
##  Pearson's product-moment correlation
## 
## data:  overall_avg_ISC_DFR and data_to_plot$BPRS_TOT
## t = -0.75607, df = 168, p-value = 0.4507
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.2069336  0.0930971
## sample estimates:
##         cor 
## -0.05823314
ggplot(data=data_to_plot,aes(x=overall_avg_ISC_DFR,omnibus_span_no_DFR_MRI))+
  geom_point()+
  stat_smooth(method="lm")+
  ggtitle("Avg ISC DFR vs omnibus span")
## `geom_smooth()` using formula 'y ~ x'

ggplot(data=data_to_plot,aes(x=overall_avg_ISC_DFR,XDFR_MRI_ACC_L3))+
  geom_point()+
  stat_smooth(method="lm")+
  ggtitle("Avg ISC DFR vs L3 DFR Acc")
## `geom_smooth()` using formula 'y ~ x'

ggplot(data=data_to_plot,aes(x=overall_avg_ISC_DFR,WHO_ST_S32))+
  geom_point()+
  stat_smooth(method="lm")+
  ggtitle("Avg ISC DFR vs WHODAS")
## `geom_smooth()` using formula 'y ~ x'

ggplot(data=data_to_plot,aes(x=overall_avg_ISC_DFR,BPRS_TOT))+
  geom_point()+
  stat_smooth(method="lm")+
  ggtitle("Avg ISC DFR vs BPRS Total")
## `geom_smooth()` using formula 'y ~ x'

If we break it down by TR, we again see correlations between ISC in the DFR regions and omnibus span at TR 10 and 11, WHODAS at TR 10 (but same concerns as above), and accuracy at TRs 1, 2, 4, 5, 6, 7, 10, 11, 12, and 13.

corr_ISC(avg_ISC_DFR,data_to_plot[,c(1,7)])
## [1] "TR: 1; measure: omnibus_span_no_DFR_MRI"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 1.2683, df = 168, p-value = 0.2064
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.05391824  0.24431936
## sample estimates:
##        cor 
## 0.09738635 
## 
## [1] "TR: 2; measure: omnibus_span_no_DFR_MRI"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 0.75685, df = 168, p-value = 0.4502
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.09303749  0.20699119
## sample estimates:
##        cor 
## 0.05829306 
## 
## [1] "TR: 3; measure: omnibus_span_no_DFR_MRI"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 0.24746, df = 168, p-value = 0.8049
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1318047  0.1691166
## sample estimates:
##        cor 
## 0.01908822 
## 
## [1] "TR: 4; measure: omnibus_span_no_DFR_MRI"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 0.57404, df = 168, p-value = 0.5667
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1069822  0.1934704
## sample estimates:
##       cor 
## 0.0442445 
## 
## [1] "TR: 5; measure: omnibus_span_no_DFR_MRI"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 0.50633, df = 168, p-value = 0.6133
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1121385  0.1884417
## sample estimates:
##        cor 
## 0.03903458 
## 
## [1] "TR: 6; measure: omnibus_span_no_DFR_MRI"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 0.44078, df = 168, p-value = 0.6599
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1171262  0.1835624
## sample estimates:
##        cor 
## 0.03398721 
## 
## [1] "TR: 7; measure: omnibus_span_no_DFR_MRI"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 0.74526, df = 168, p-value = 0.4572
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.09392242  0.20613655
## sample estimates:
##        cor 
## 0.05740332 
## 
## [1] "TR: 8; measure: omnibus_span_no_DFR_MRI"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 0.32444, df = 168, p-value = 0.746
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1259652  0.1748791
## sample estimates:
##        cor 
## 0.02502352 
## 
## [1] "TR: 9; measure: omnibus_span_no_DFR_MRI"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 0.14285, df = 168, p-value = 0.8866
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1397255  0.1612673
## sample estimates:
##       cor 
## 0.0110205 
## 
## [1] "TR: 10; measure: omnibus_span_no_DFR_MRI"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 2.1608, df = 168, p-value = 0.03212
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.01428222 0.30735000
## sample estimates:
##      cor 
## 0.164443
## `geom_smooth()` using formula 'y ~ x'

## [1] "TR: 11; measure: omnibus_span_no_DFR_MRI"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 2.2695, df = 168, p-value = 0.02451
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.02254113 0.31481220
## sample estimates:
##       cor 
## 0.1724702
## `geom_smooth()` using formula 'y ~ x'

## [1] "TR: 12; measure: omnibus_span_no_DFR_MRI"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 0.37686, df = 168, p-value = 0.7068
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1219848  0.1787952
## sample estimates:
##        cor 
## 0.02906309 
## 
## [1] "TR: 13; measure: omnibus_span_no_DFR_MRI"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -0.25791, df = 168, p-value = 0.7968
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1698995  0.1310125
## sample estimates:
##         cor 
## -0.01989402
corr_ISC(avg_ISC_DFR,data_to_plot[,c(1,9)])
## [1] "TR: 1; measure: WHO_ST_S32"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -0.083989, df = 168, p-value = 0.9332
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1568411  0.1441751
## sample estimates:
##         cor 
## -0.00647977 
## 
## [1] "TR: 2; measure: WHO_ST_S32"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 0.35747, df = 168, p-value = 0.7212
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1234574  0.1773474
## sample estimates:
##        cor 
## 0.02756911 
## 
## [1] "TR: 3; measure: WHO_ST_S32"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 0.28112, df = 168, p-value = 0.779
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1292525  0.1716377
## sample estimates:
##        cor 
## 0.02168359 
## 
## [1] "TR: 4; measure: WHO_ST_S32"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -0.56962, df = 168, p-value = 0.5697
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1931424  0.1073189
## sample estimates:
##         cor 
## -0.04390453 
## 
## [1] "TR: 5; measure: WHO_ST_S32"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -0.66307, df = 168, p-value = 0.5082
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.2000657  0.1001948
## sample estimates:
##         cor 
## -0.05108995 
## 
## [1] "TR: 6; measure: WHO_ST_S32"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -0.96747, df = 168, p-value = 0.3347
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.22245664  0.07694159
## sample estimates:
##         cor 
## -0.07443467 
## 
## [1] "TR: 7; measure: WHO_ST_S32"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -0.44912, df = 168, p-value = 0.6539
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1841842  0.1164915
## sample estimates:
##         cor 
## -0.03462992 
## 
## [1] "TR: 8; measure: WHO_ST_S32"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 0.069995, df = 168, p-value = 0.9443
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1452322  0.1557878
## sample estimates:
##         cor 
## 0.005400146 
## 
## [1] "TR: 9; measure: WHO_ST_S32"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -0.64648, df = 168, p-value = 0.5189
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1988384  0.1014600
## sample estimates:
##         cor 
## -0.04981498 
## 
## [1] "TR: 10; measure: WHO_ST_S32"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -2.8258, df = 168, p-value = 0.005289
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.35223211 -0.06456666
## sample estimates:
##        cor 
## -0.2130108
## `geom_smooth()` using formula 'y ~ x'

## [1] "TR: 11; measure: WHO_ST_S32"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -1.2692, df = 168, p-value = 0.2061
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.2443870  0.0538465
## sample estimates:
##         cor 
## -0.09745762 
## 
## [1] "TR: 12; measure: WHO_ST_S32"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -0.7545, df = 168, p-value = 0.4516
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.20681817  0.09321668
## sample estimates:
##         cor 
## -0.05811292 
## 
## [1] "TR: 13; measure: WHO_ST_S32"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 0.33882, df = 168, p-value = 0.7352
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1248736  0.1759540
## sample estimates:
##        cor 
## 0.02613178
corr_ISC(avg_ISC_DFR,data_to_plot[,c(1,15)])
## [1] "TR: 1; measure: BPRS_TOT"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -0.7782, df = 168, p-value = 0.4375
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.20856475  0.09140692
## sample estimates:
##         cor 
## -0.05993188 
## 
## [1] "TR: 2; measure: BPRS_TOT"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -0.38731, df = 168, p-value = 0.699
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1795752  0.1211909
## sample estimates:
##         cor 
## -0.02986822 
## 
## [1] "TR: 3; measure: BPRS_TOT"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -1.2806, df = 168, p-value = 0.2021
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.24520652  0.05297723
## sample estimates:
##         cor 
## -0.09832101 
## 
## [1] "TR: 4; measure: BPRS_TOT"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 0.43771, df = 168, p-value = 0.6622
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1173598  0.1833336
## sample estimates:
##        cor 
## 0.03375068 
## 
## [1] "TR: 5; measure: BPRS_TOT"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 1.1809, df = 168, p-value = 0.2393
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.0606060  0.2379998
## sample estimates:
##        cor 
## 0.09073595 
## 
## [1] "TR: 6; measure: BPRS_TOT"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -0.64348, df = 168, p-value = 0.5208
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1986161  0.1016890
## sample estimates:
##         cor 
## -0.04958416 
## 
## [1] "TR: 7; measure: BPRS_TOT"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -1.5122, df = 168, p-value = 0.1324
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.2618275  0.0352491
## sample estimates:
##      cor 
## -0.11588 
## 
## [1] "TR: 8; measure: BPRS_TOT"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -1.5472, df = 168, p-value = 0.1237
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.26432963  0.03256403
## sample estimates:
##        cor 
## -0.1185312 
## 
## [1] "TR: 9; measure: BPRS_TOT"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 0.84554, df = 168, p-value = 0.399
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.08626267  0.21351897
## sample estimates:
##        cor 
## 0.06509678 
## 
## [1] "TR: 10; measure: BPRS_TOT"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -0.62483, df = 168, p-value = 0.5329
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1972356  0.1031108
## sample estimates:
##         cor 
## -0.04815076 
## 
## [1] "TR: 11; measure: BPRS_TOT"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -0.97953, df = 168, p-value = 0.3287
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.22333849  0.07601906
## sample estimates:
##         cor 
## -0.07535742 
## 
## [1] "TR: 12; measure: BPRS_TOT"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -1.4151, df = 168, p-value = 0.1589
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.25488139  0.04268073
## sample estimates:
##        cor 
## -0.1085307 
## 
## [1] "TR: 13; measure: BPRS_TOT"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = -0.27633, df = 168, p-value = 0.7826
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1712794  0.1296154
## sample estimates:
##         cor 
## -0.02131465
corr_ISC(avg_ISC_DFR,data_to_plot[,c(1,21)])
## [1] "TR: 1; measure: XDFR_MRI_ACC_L3"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 2.957, df = 168, p-value = 0.003555
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.07439591 0.36085343
## sample estimates:
##       cor 
## 0.2224196
## `geom_smooth()` using formula 'y ~ x'

## [1] "TR: 2; measure: XDFR_MRI_ACC_L3"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 3.4365, df = 168, p-value = 0.0007426
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.1100095 0.3916857
## sample estimates:
##       cor 
## 0.2562803
## `geom_smooth()` using formula 'y ~ x'

## [1] "TR: 3; measure: XDFR_MRI_ACC_L3"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 1.3262, df = 168, p-value = 0.1866
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.04948583  0.24849381
## sample estimates:
##       cor 
## 0.1017866 
## 
## [1] "TR: 4; measure: XDFR_MRI_ACC_L3"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 3.1757, df = 168, p-value = 0.001779
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.09070712 0.37505292
## sample estimates:
##       cor 
## 0.2379724
## `geom_smooth()` using formula 'y ~ x'

## [1] "TR: 5; measure: XDFR_MRI_ACC_L3"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 4.6454, df = 168, p-value = 6.823e-06
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.1968684 0.4643209
## sample estimates:
##       cor 
## 0.3373854
## `geom_smooth()` using formula 'y ~ x'

## [1] "TR: 6; measure: XDFR_MRI_ACC_L3"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 5.7618, df = 168, p-value = 3.885e-08
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.2723409 0.5246422
## sample estimates:
##       cor 
## 0.4062044
## `geom_smooth()` using formula 'y ~ x'

## [1] "TR: 7; measure: XDFR_MRI_ACC_L3"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 4.8137, df = 168, p-value = 3.284e-06
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.2085669 0.4738363
## sample estimates:
##       cor 
## 0.3481519
## `geom_smooth()` using formula 'y ~ x'

## [1] "TR: 8; measure: XDFR_MRI_ACC_L3"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 1.919, df = 168, p-value = 0.05668
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.004150015  0.290564854
## sample estimates:
##       cor 
## 0.1464557 
## 
## [1] "TR: 9; measure: XDFR_MRI_ACC_L3"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 0.77777, df = 168, p-value = 0.4378
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.09143991  0.20853293
## sample estimates:
##        cor 
## 0.05989873 
## 
## [1] "TR: 10; measure: XDFR_MRI_ACC_L3"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 3.0789, df = 168, p-value = 0.002427
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.08350399 0.36879875
## sample estimates:
##       cor 
## 0.2311135
## `geom_smooth()` using formula 'y ~ x'

## [1] "TR: 11; measure: XDFR_MRI_ACC_L3"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 5.0663, df = 168, p-value = 1.06e-06
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.2259176 0.4878359
## sample estimates:
##       cor 
## 0.3640527
## `geom_smooth()` using formula 'y ~ x'

## [1] "TR: 12; measure: XDFR_MRI_ACC_L3"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 3.7665, df = 168, p-value = 0.0002287
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.1341716 0.4122498
## sample estimates:
##       cor 
## 0.2790505
## `geom_smooth()` using formula 'y ~ x'

## [1] "TR: 13; measure: XDFR_MRI_ACC_L3"
## 
##  Pearson's product-moment correlation
## 
## data:  TR_data[, TR] and measure[, 2]
## t = 3.0499, df = 168, p-value = 0.002661
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.08133945 0.36691431
## sample estimates:
##       cor 
## 0.2290495
## `geom_smooth()` using formula 'y ~ x'